Monthly Archiv: November, 2015

PHP Ghost Crypt

Package:
PHP Ghost Crypt
Summary:
Encrypt PHP code and generate self decrypting code
Groups:
Code Generation, Cryptography, PHP 5
Author:
Nick Daniels
Description:
This class can encrypt PHP code and generate self decrypting code...

Read more at http://www.phpclasses.org/package/9381-PHP-Encrypt-PHP-code-and-generate-self-decrypting-code.html#2015-11-18-09:00:09

Using Flexbox to Create a Responsive Comment Section

flexbox-responsive-comment-section

Flexbox is a powerful new way for building layouts that makes some of the most challenging aspects of web development trivial. Nearly all browsers that are used today support it, so it is a good time to see how it can fit in your typical day-to-day frontend work.

This is why in this quick tutorial we’re going to build a comment section using flexbox. We’ll take a look at some of the more interesting properties that the flexbox layout mode has to offer and show you how to take full advantage of it.

What We’re Going to Use

Flexbox consists of a number of CSS properties, some of which we are going to use today:

  • display: flex – This activates the flex layout mode and makes the element’s children follow flexbox rules.
  • justify-content – This property defines where the children of a flexbox element will align to (this is similar to text-align, read more here).
  • order – Flexbox gives us control on the exact position elements are displayed at. We use this powerful tool in our comment section to switch the text and photo around (find out more here).
  • flex-wrap – Controls the wrapping of the elements within the flex element. We use this to force the avatars to show beneath the comment text on small screens (flex-wrap on MDN).

The Layout

We want our comment section to meet the following requirements:

  • Each comment should have an avatar, name, time and comment body.
  • There should be two comment types – those written by the author (colored in blue and having the avatar on the right) and those written by everyone else.
  • The HTML markup for both types of comments has to be as similar as possible, so it is easy to generate comments through code.
  • The whole thing has to be fully responsive.
Comment Section Layout

Comment Section Layout

All of this can be made with a few lines of CSS with flexbox. Let’s move on the the code!

The HTML

Our HTML is pretty straightforward. We’ll have a list of comments with a basic form for writing new comments at the end.

<ul class="comment-section">

    <li class="comment user-comment">
        <div class="info">
            <a href="#">Anie Silverston</a>
            <span>4 hours ago</span>
        </div>
        <a class="avatar" href="#">
            <img src="images/avatar_user_1.jpg" width="35" alt="Profile Avatar" title="Anie Silverston" />
        </a>
        <p>Suspendisse gravida sem?</p>
    </li>

    <li class="comment author-comment">
        <div class="info">
            <a href="#">Jack Smith</a>
            <span>3 hours ago</span>
        </div>
        <a class="avatar" href="#">
            <img src="images/avatar_author.jpg" width="35" alt="Profile Avatar" title="Jack Smith" />
        </a>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse gravida sem sit amet molestie portitor.</p>

    </li>

    <!-- More comments -->

    <li class="write-new">

        <form action="#" method="post">
            <textarea placeholder="Write your comment here" name="comment"></textarea>
            <div>
                <img src="images/avatar_user_2.jpg" width="35" alt="Profile of Bradley Jones" title="Bradley Jones" />
                <button type="submit">Submit</button>
            </div>
        </form>

    </li>

</ul>

If you look closely at the above code, you’ll notice that apart from having different classes, the HTML for the user comments and the author comments are practically the same. All of the stylistic and layout differences between the two, will be handled solely by CSS applied to the .user-comment and .author-comment classes.

The CSS

Here we’re going to look at flexbox-related techniques we’ve used when building the layout. If you want to examine the stylesheet in full detail, download the whole CSS file from the button near the top of the article.

First off, we are going to give all comments display: flex, which will enable us to use the flexbox properties on the comments and their child elements.

.comment{
    display: flex;
}

These flex containers span the full width of our comment section and hold the user info, avatar and message. Since we want the comments written by the author to be aligned to the right, we can use the following flex property and align everything towards the end of our container.

.comment.author-comment{
    justify-content: flex-end;
}

This will leave the comments looking like this:

justify-content: flex-end

justify-content: flex-end

Now we have the author comment aligned on the right, but we also want to have the elements inside the container in reverse order, so that the message comes first, then the avatar and the info on the far right. To do this we will take advantage of the order property.

.comment.author-comment .info{
    order: 3;
}

.comment.author-comment .avatar{
    order: 2;
}

.comment.author-comment p{
    order: 1;
}

As you can see, with the help of flexbox, the whole thing couldn’t be any easier.

Reordering Elements

Reordering Elements

Our comment section looks just like we wanted it to. The only thing left to do is make sure that it looks good on smaller devices as well. Since there won’t be as much available space on a narrower screen, we’ll have to do some rearrangements to the layout and make our content more easily readable.

We set up a media query that makes the comment paragraphs expand, taking up the whole width of the container. This will lead to the avatar and user info moving to the next line, since the comments have their flex-wrap property set to wrap.

@media (max-width: 800px){
    /* Reverse the order of elements in the user comments,
    so that the avatar and info appear after the text. */
    .comment.user-comment .info{
        order: 3;
    }

    .comment.user-comment .avatar{
        order: 2;
    }

    .comment.user-comment p{
        order: 1;
    }


    /* Make the paragraph in the comments take up the whole width,
    forcing the avatar and user info to wrap to the next line*/
    .comment p{
        width: 100%;
    }


    /* Align toward the beginning of the container (to the left)
    all the elements inside the author comments. */
    .comment.author-comment{
        justify-content: flex-start;
    }
}

The difference can be spotted right away by comparing this screen capture with the one above. You can also try opening the demo and resizing your browser to watch the comment section adapt accordingly to the size of the window.

Our comment section on smaller screens

Our comment section on smaller screens

Conclusion

This sums up our tutorial. We hope that this gave you a practical example on how to use flexbox when building real layouts. If you’re curious what else is possible, here are a few great resources that you’ll like:

  • CSS-Tricks’ guide to flexbox – here.
  • An in-depth MDN article – here.
  • A website with easy flexbox solutions for classic CSS problems – here.

6 Free Tools for Creating Your Own Icon Font

Although there are many icon font sets (such as Font Awesome and Iconic) that you can readily use in your UI designs, there are times when you might want to generate your own custom icon font. For instance, you might have icons that you have designed that you would like to convert into an icon font set, or perhaps you would like to combine icons from various icon font sets.

Fortunately, creating icon fontsis fairly simple.  Here are some free icon font generators that allow you to create your own icon fonts.

1. Fontello

Fontello offers a simple platform you can use to generate your own icon font. To create your icon font, simply drag SVG files from your computer and drop them on the area located under the “Custom Icons” heading. You can also incorporate icons from free icon sets by selecting them in Fontello.

Fontello

2. IcoMoon App

The IcoMoon App allows you to import your own icons as well as include icons from the IcoMoon icon set and other free icon sets. The total number of icons available within the IcoMoon App is in the thousands.

IcoMoon App

3. Icon Vault

To generate your own icon font with Icon Vault, you first have to download their template package. Then just follow the instructions included in the template package. Once you’re done, upload your icons onto Icon Vault.

Icon Vault

4. Pictonic Fontbuilder

The Pictonic Fontbuilder allows you to choose from Pictonic’s free and paid icons in order to build your own customized Pictonic icon font. Pictonic has over 2,700 icons to choose from, and over 300 of them are free. Accessing the Pictonic Fontbuilder requires account sign-up.

Pictonic Fontbuilder

5. Glyphter

When you go to Glyphter, you will see a character grid on the left. The right side of the screen, called the “icon shelf”, is where you will find free icons and a search bar. Simply drag and drop the icons you want to use from the icon shelf, into one of the boxes on the grid. You can also upload your own SVG icon files by clicking on the boxes on the grid. You can have up to 88 icons in your icon font for free. If you need to have more icons, you will need to sign up for a premium account.

Glyphter

6. Fontastic

To generate your own icon font with Fontastic, select icons from the available free icon sets (such as Streamline Icons and Entypo) and/or upload your own custom SVG icons. Once you’re all set, go to the “Publish” tab, where you will have the option to host your icon font on Fontastic’s Icon Cloud or download your icon font. Accessing the Fontastic icon font generator requires account sign-up.

Fontastic

Read Next

Adrienne Erin is a freelance writer and designer. She’s the founder of Design Roast, a blog that features helpful guides, inspiration, and posts about making it as a freelance designer. Follower her on Twitter.

The post 6 Free Tools for Creating Your Own Icon Font appeared first on WebFX Blog.

PHP Telegram CLI Wrapper

Package:
PHP Telegram CLI Wrapper
Summary:
Send messages and other commands to Telegram users
Groups:
Chat, PHP 5, Unix
Author:
Joseluis Laso
Description:
This class can send messages and other commands to Telegram users...

Read more at http://www.phpclasses.org/package/9493-PHP-Send-messages-and-other-commands-to-Telegram-users.html#2015-11-16-17:24:48

9 Useful Tools for Creating Material Design Color Palettes

One of the biggest things you’ll notice in material design is the use of bold, vibrant colors.

Material design’s color guidelines describe the color style as being “inspired by bold hues juxtaposed with muted environments, deep shadows, and bright highlights.”

If you need to generate material design color palettes, these online tools will help.

1. Material Palette

In this tool, you start by picking your primary color and accent color. Afterwards, it will show you a live preview of the generated color palette and offer you a variety of ways to download it.

Material palette color palette

2. Material UI’s Material Design Colors

This is a nifty “cheatsheet” that presents all of the material design colors in one page.

Cheat sheet that lists all the colors in one page

3. Random Material Generator

Do you want to let fate decide what your color palette should be? Use this tool to randomly choose your material design colors.

Random material generator example

4. Material Design Palette Generator

If you’re interested in creating a custom, material-design-like color palette, check out this tool. First, you need to specify a color — and it doesn’t have to be one of the official material design colors — using a color picker dialog window similar to the ones you can find in your favorite graphics editor. The Material Design Palette Generator will then generate color swatches based on your chosen color.

Material design palette generator example

5. Material Mixer

This useful tool shows all material design colors in a conveniently compact grid layout. Click on a primary color and accent color to preview and generate your color palette.

material mixer example

6. Material Colors

This tool displays just the 500 and A200 colors of material design color swatches.

material design color swatches

7. MaterialUp’s Material Design Colors

This is another simple tool for visualizing material design colors. It shows the primary colors side-by-side. Clicking on a “color bar” shows all of the color swatches associated with that color.

primary colors side-by-side

8. Tint UI’s Material Design

This tool displays just the material design 500 colors.

Material design 500 colors example

9. designskilz’s Material Design Colors

This simple tool helps you visualize all the material design color swatches along with their official names (e.g. Pink, Light Blue, etc.).

designskilz's material Ddsign colors example

Material Design Color Plugins for Graphics Editors

If web tools aren’t your thing, you can instead install a plugin/extension that integrates the material design color swatches right into your design software.

Read Next

Jacob Gube is the founder of Six Revisions. He’s a front-end developer. Connect with him on Twitter.

The post 9 Useful Tools for Creating Material Design Color Palettes appeared first on WebFX Blog.

USDA PHP Nutritional Products Database Wrapper (New)

Package:
USDA PHP Nutritional Products Database Wrapper
Summary:
Retrieve nutritional data from USDA database
Groups:
Biology, PHP 5, Web services
Author:
Dave Smith
Description:
This can retrieve nutritional data from USDA database...

Read more at http://www.phpclasses.org/package/9412-PHP-Retrieve-nutritional-data-from-USDA-database.html

Magento BrasPress (New)

Package:
Magento BrasPress
Summary:
Magento extension to handle Braspress deliveries
Groups:
E-Commerce, Geography, PHP 5, Web services
Author:
Julio Cezar Kronbauer
Description:
This package is a Magento extension to handle Braspress deliveries...

Read more at http://www.phpclasses.org/package/9473-PHP-Magento-extension-to-handle-Braspress-deliveries.html
Powered by Gewgley