Monday, November 14, 2016

Martin Legrand

opl-small

Minimal One Pager with random scattered images for Brookyln-based French designer, Martin Legrand.

by Rob Hope via One Page Love

UX Talks

UX Talks 002

Long scrolling One Pager promoting the second 'UX Talks' event that took place early November. Lovely intro color gradient that is consistently reused in elements throughout the page (favicon, drop-caps, speaker names, buttons).

by Rob Hope via One Page Love

From Novice to Ninja: How to Master Using Plugins in Rails

[special]This article is an excerpt from "Rails: Novice To Ninja" by Glenn Goodrich and Patrick Lenz. You can purchase the full version of this book here.[/special]

Rails Plugins

While this book is unable to cover all of the built-in functionality that ships with Rails—and there's plenty of functionality for you to discover and experiment with once you're beyond the last chapter— the plugins architecture of Rails warrants our attention.

What is a plugin?

A plugin is a component that you can add to your application to extend its functionality. While you can certainly write your own plugins, we'll limit our discussion here to using existing plugins. Plugins have been developed for various parts of the Rails framework, adding functionality such as:

  • extensions to ActiveRecord functionality
  • helper methods
  • new template engines (for coding a view using an alternate templating language)

The number of existing Rails plugins is enormous and grows every day. Programmers in the Ruby and Rails communities are excellent about sharing code and creating useful plugins based on extensions they need. A good resource of existing Rails plugins can be found by searching for "Rails" on the Rubygems site or on the Ruby Toolbox site.

Plugins are distributed as gems, which we covered in Chapter 2. Plugins can be pulled into an existing Rails application by adding them to the Gemfile and running bundle install. You probably remember our discussion about Bundler from Chapter 4, where its job is to manage application dependencies. Bundler makes including existing plugins into our app a breeze.

Finding a plugin that does what you require is usually just a Google or RubyGems search away. As seen in Figure 10-1, searching for "rails tagging" brings up a few gems that have been created, including one called acts-as-taggable-on.

[caption id="attachment_143334" align="alignnone" width="806"]Figure 10-1. Searching for a plugin on "rails tagging" Figure 10-1. Searching for a plugin on "rails tagging"[/caption]

The overwhelming majority of gems keep their source on GitHub, including acts-as-taggable-on from the first link in our search above. Following that link leads to the source on GitHub, as shown in Figure 10-2.

[caption id="attachment_143336" align="alignnone" width="1024"]10-2. The GitHub repository for 'acts-as-taggable-on' 10-2. The GitHub repository for 'acts-as-taggable-on' [/caption]

Most GitHub source repositories have a README or README.md file that explains what the gem does, how to install and use it, and so on. acts-as-taggable-on follows this convention, which can be seen in Figure 10-3. It explains the object of the gem, the supported versions of Rails, as well as how to install and configure the gem.

[caption id="attachment_143337" align="alignnone" width="1024"]10-3. A standard README file. 10-3. A standard README file.[/caption]

After reading through the README.md, we now know how to pull the gem into our application and use its functionality. You may feel that walking through the topic of "how to find and learn about gems" is a bit tedious, but you will find yourself spending loads of time doing just that–so I figured it was tedium well spent.

No Time for Name-calling

There are many ways to extend Rails; for example, by using a "plugin", "engine", and "railtie", to name a few. While there are technical differences between these items, they are often (incorrectly) used interchangeably. Defining these terms and their differences is beyond the scope of this book, so I'm going to stick to the word "plugin" for now. As you grow in your Rails-fu, you'll no doubt want to do some research around Rails extensibility. Boom–I just turned this note into an EXTRA CREDIT!

Okay, enough theory! Let's go ahead and install our first plugin.

Continue reading %From Novice to Ninja: How to Master Using Plugins in Rails%


by Glenn Goodrich via SitePoint

Let's Go: Golang Code Organization

Go is a special language among modern languages. It is very opinionated. For example, there is one true formatting. Go will tell you how to space your code and where to put your curly braces. But it goes much deeper than that. 

Go will also tell you how to capitalize your functions and variables to make them public or private. It will dictate the directory structure of your code. This may come as a surprise for developers coming to Go from more liberal programming languages. 

In this article, I'll explore some of Go's restrictions, discuss their merits, and suggest options for common situations.

Project Euler

When I started learning Go, I created a solution to Problem #6 and just put it in a sub-directory alongside solutions to other problems in other languages. See Project Euler.

The issue is that Go doesn't want you to just scatter Go files randomly all over the place. I later realized that while it works in very simple cases where you don't import other packages, it is not proper.

Dependencies

Every non-trivial program is composed of multiple files or modules or components or classes. I'll just use "file" as a general term. They are often grouped in libraries or packages or assemblies. I'll just use "package" as a general term. The code you write depends on code in other files and packages. 

You need to tell your code how to find those packages and files in order to use their functionality. Each language has its own term: import, include, require. I'll just use "import" as a general term.

Some languages (or language specific tools) also allow you to install dependencies from a remote package repository and install them into a standard local location you can import from.

In most common programming languages, you have a lot of freedom. In C/C++, you tell the compiler/linker where the files and static libraries are (using command-line switches or environment variables like INCLUDE_DIR). In Python, you can install packages from PyPI using setup.py or with pip from PyPI and remote source control repositories. You then import based on the sys.path package search path.

The Go Way

Go, as always, is more prescriptive. It may offend your creativity that you don't get as much say about where to place things, but at the end of the day it doesn't really matter, and there is enough flexibility to accommodate various situations.

Go requires that you put your code in a workspace. A workspace is just a directory with three sub-directories: src, pkg, and bin. It is recommended that you keep all your projects under a single workspace. This way they can depend on each other and share common third-party packages.

Note: I currently work on Windows and use PowerShell for many of the interactive examples. For the following section, I wanted to show the directory structure of my workspace using the tree command. Windows has its own tree.exe command, but it is very limited (no levels). There is allegedly a full-fledged tree command for Windows here

But the site was unreachable. I ended up firing a Docker container running Ubuntu, mounting my Go workspace as /docs/Go, and using the Linux tree command to show it. So don't be confused if you see a Linux environment showing Windows directories and files with .exe suffixes.

Here is my current Go workspace. The bin directory contains various Go commands/tools, and the delve debugger. The pkg dir has a sub-directory with the platform (Win 64) that contains the packages organized by their origin (github.com, golang.com, etc.). The src directory has similar sub-directories for the origin repository or website (github.com, golang.org, etc.).

Let's take a look inside one of the source projects I created under src: the go-web-crawler. It is pretty simple here: just a flat list of Go files, a license, and a README file.

GOROOT and GOPATH

Two environment variables control your destiny in the land of Go. GOROOT is where the Go installation is:

Note that the Go root directory looks like a superset of a workspace with the src, bin, and pkg directories.

GOPATH points to your workspace. That's how Go finds your code.

There are a bunch of other Go related environment variables, many of which you were required to set in the past (e.g. GOOS and GOARCH). Now, they are optional, and you should not mess with them unless you really need to (e.g. when cross-compiling). To see all the Go environment variables, type: go env.

Installs and Imports

When you create a Go program or a library, you can install it. Programs go to your workspace's bin directory, and libraries go to the workspace's pkg directory. On Windows, I discovered that your %GOPATH%/bin is not in the %PATH% directory, so Windows couldn't find my executable. I added it to the Windows PATH and everything worked. Here is how to check in PowerShell that your PATH contains your workspace bin directory:

Let's see all that in action.

If I go to my go-web-crawler directory and type go install then go-web-crawler.exe is created in c:\Users\the_g\Documents\Go\bin:

I can now run it from my Go web crawler from anywhere.

Multiple Go Environments

That's all fine, but sometimes life is not so simple. You may want to have multiple separate workspaces. What's more, you may want to have multiple installations of Go (e.g. different versions) and multiple workspaces for each one. You can do this by dynamically setting GOPATH for changing the workspace and setting GOROOT for changing the active Go installation.

There are various open-source projects for vendoring, package management, and virtual environments. For some reason, most don't support Windows. I'm not sure why such tools have to be platform-specific. I may write a cross-platform Go environment manager myself one of these days.

Conclusion

Go is all about eliminating incidental complexity. Sometimes it comes off as very strict and prescriptive. But if you get into the mindset of the Go designers, you start to understand that avoiding, forbidding or mandating certain things really makes everything simpler.


by Gigi Sayfan via Envato Tuts+ Code

How to Draw Charts Using JavaScript and HTML5 Canvas

How to Get Started With Android's Native Development Kit

The “Most Loved” One Page Websites from October 2016

one-page-love-hosting-reviews-bh-unlimitedOctobers “Most Loved” One Page website round-up is brought to you by hosting provider, Bluehost.

Bluehost is the most affordable hosting option to host your One Page websites. They have an incredible $2.95/month deal exclusive to One Page Readers where you can host your website with 50GB diskspace and unlimited bandwidth. They also throw in a free domain!

If you want to receive these “Most Loved” awards in your inbox each month, subscribe to our Inspiration Newsletter.

Below are the 7 One Page websites we awarded “Most Loved” in October – hope you enjoy!


Best Friends Forever (Portfolio)

Gorgeous big imagery in this parallax scrolling One Pager for Melbourne-based design studio, Best Friends Forever. The awesome SVG illustrations and animations (by Sean Morris) bring so much character to the portfolio. Also a great references to a quality team section – especially the additional founder section further down that animates. We forget how important building trust is for when potential clients browse our portfolios.

Launch Website
Full Review


ScrollReveal (Download)

Slick One Pager for ‘ScrollReveal’ – a tiny JS library by Julian Lloyd that allows easy scroll animations for web and mobile browsers. What a beautiful way to showcase a JS library – tons of color, gorgeous animation and of course a perfect demonstration of the product.

Launch Website
Full Review


NewActon (Accommodation, Informational, Landing Page, Restaurant)

AJAX loading One Pager that forms a visual directory for Canberra’s arts and cultural precinct, NewActon. The Single Page website features lovely illustrations representing each category of residency/service within the location. What a special x-factor how the site uses a dynamic weather driven color palette to reflect the mood of the precinct in the website itself (you can demo this by changing the day of weather bottom-left).

Launch Website
Full Review


Luca (Restaurant)

Spacious, colorful One Pager for London-based Italian restaurant, Luca. The Single Page site fills a big screen well and the food photography is gorgeous on all resolutions. Final shout out to the clean mobile adaption of the food menu – so many restaurant sites get lazy at this point in the build. Great work.

Launch Website
Full Review


Hire the Donald (Résumé)

‘Hire the Donald’ is a hilarious One Pager acting as Donald Trump’s job application for commander in chief. Genuine laughs at that loading icon in the qualifications section and lovely touch with the angled CV intro (with links in the copy). Other features include references, interactive endorsement section, skills, accomplishments and ends with a big wall covering the whole Single Page site (promoting Hillary’s campaign of course). Excellent work by Hum Creative.

Launch Website
Full Review


BIGSOUND Buzz (Experimental, Informational, Music Related)

Unique and impressive One Pager providing real-time stats of the most talked about artists from BIGSOUND festival 2016 based on social media. What an awesome interactive Vinyl illustration that hosts recent activity about each of the Top 10 artists. Also lovely touch with the infographic switcher from pie (vinyl) to bar graph views.

Launch Website
Full Review


Nuage (App, Landing Page, Startup)

Vibrant, clean design with gorgeous load transitions in this AJAX loading Landing Page for new domain management tool, Nuage. Lovely touch – when hovering over the mini header logo – that “flashes” all the brands colors.

Launch Website
Full Review


Hope you enjoyed these beautiful One Pagers from October! Big love to hosting provider Bluehost for sponsoring the round up:)


by Rob Hope via One Page Love