background preloader

Rails-related

Facebook Twitter

5 Unix Commands I Wish I'd Discovered Years Earlier. I’ve been using *nix systems for quite a while.

5 Unix Commands I Wish I'd Discovered Years Earlier

But there are a few commands that I somehow overlooked and I wish I’d discovered years earlier. 1. man ascii This prints out the ascii tables in octal, hexadeciamal and decimal. Frontend - Front-end design first, or back-end development first? For Ruby on Rails site. Snippet Tutorial - Short Circuiting. Typically we cover something that is language specific, focusing on syntax solutions that help you with your projects.

Snippet Tutorial - Short Circuiting

Today we are going to step back a bit and talk about a feature of programming that I think is neat and worthy of talking about. This feature is known as Short-Circuiting, and it may elude some of you beginners out there. Perhaps we should begin with an explanation. Short-Circuiting is a term used to describe logical operators that only evaluate if the first does not.

For example, lets take the following PHP snippet: $one = true; $two = false; if($one == null && ! In the context of short-circuiting, the second logical test would never get evaluated because the first one in the line already failed. You may be asking yourself "Why would I need this? " Bootstrap your Web Application with Ruby & Sinatra. In this tutorial, I am going to show you how you can rapidly create a good looking website, with as little code as possible.

Bootstrap your Web Application with Ruby & Sinatra

By making use of the awesome Bootstrap templates that Twitter have provided, alongside Ruby and the Sinatra web framework, we can get a professional template site upon which to build in little more than a lunch break. Ruby and RVM The first part of our process is to get Ruby up and running on our machine. For this tutorial, I am going to be using a Mac, running OS X Mountain Lion but the process should be the same for Linux. Windows users should look to the full RVM installation instructions.

Installing RVM allows us to easily manage the version of Ruby we want to use for our different projects and also keep our dependencies separate for each of these project too. But first, lets install RVM and then see how it picks up these files. . $ curl -#L | bash -s stable --autolibs=3 --ruby Once the install has completed close your shell and open up a new one. Great! How It Works: GitHub's Pipeline of Filters. GitHub's Issue Tracker is a great tool to collaborate on open source projects.

How It Works: GitHub's Pipeline of Filters

You can write comments in Markdown, add things like emoji, @ mentions, and code blocks, and they'll all get converted correctly to HTML. Ever wonder how GitHub does this? In line with their philosophy of open sourcing (almost) everything, GitHub released a gem called html-pipeline, which is what powers their Issue Tracker's ability to convert user input into HTML. Documenting Your Ruby Code With YARD. This tutorial introduces YARD as a way to document your Ruby code.

Documenting Your Ruby Code With YARD

Hopefully you don't need to be sold on the value of good documentation. We've all been in a situation where we've probably wanted to use some RubyGem or application, but couldn't because the documentation was so terrible or nonexistent. For open source development, documentation can be the difference between someone using your code and someone dismissing it. For private development, documentation can help eliminate bugs and bring new teammates up to speed more quickly on various components of a system. Like testing, documentation is best done as you write your code. FineLinePrototyping / angularjs-rails-resource. A resource factory inspired by $resource from AngularJS and Misko's recommendation.

FineLinePrototyping / angularjs-rails-resource

When starting out with AngularJS and Rails we initially were using $resource but there were three things we didn't like that this gem sets out to provide: $resource didn't return promisesRails prefers JSON be root wrappedOur JSON contained snake case (underscored) keys coming from our database but we didn't want to mix snake case and camel case in our UI In case you are unfamiliar, the intent of the resource is to behave a bit like a remote model object. One of the nice things about AngularJS is that it does not require you to create specific models for all of your data which gives you a lot of freedom for treating model data as basic javascript objects. However, on the Rails side when exposing models to a javascript application you are likely going to follow the same pattern for multiple models where you will have a controller that has your basic index (query), get, create, update, delete functionality.

AngularJS with Rails - How To?? Modern workflows for modern webapps. The Yeoman workflow is comprised of three core tools for improving your productivity and satisfaction when building a web app.

Modern workflows for modern webapps

These tools are: yo - the scaffolding tool from Yeomanbower - the package management toolgrunt - the build tool Each of these projects are independently maintained by their respective communities, but work well together as a part of a prescriptive workflow for keeping you effective. Let’s walk through what these binaries can do. yo Yo is maintained by the Yeoman project and offers web application scaffolding, utilizing scaffolding templates we refer to as generators. Installing yo and some generators First, you'll need to install yo and other required tools:

ActiveRecord overdose. Rails is not MVC. There is a terminology problem in the Rails community.

Rails is not MVC

Everyone promotes Rails as a MVC framework. I did that as well. However, the truth is that Rails represents the Model2 architecture. Typical Rails bugs. As part of my research on improving Rails application, I noticed a pattern in the bugs that are quite characteristic to Rails in several applications.

Typical Rails bugs

They have certain 'visible' things in common: often security related, like leaking some information to unauthorized usersthey live somewhere in the area of business logic/persistencethey are not so easy to fix in the existing codebasethey tend to exist in groups, similar bugs in different areasthey are easy to missoften they appear during the requirements changes Overdose of ActiveRecord The reasons they exist is a combination of different things. Jlong/serve. Merrick Christensen - Grunt.js Workflow. In this article I'm going to show you how to leverage Grunt.js to completely refactor your workflow.

Merrick Christensen - Grunt.js Workflow

Follow in the footsteps of some of the most prolific open source projects in the world and leave the grunt work to Grunt.js. What is Grunt.js? Grunt.js is a fantastic task-based command line tool written in JavaScript on top of the wonderful Node.js platform. You can leverage Grunt.js to script away all of your grunt work. Tools and procedures that you historically ran and configured yourself, you can now abstract behind a convention based command line interface with a consistent means of configuration.

What are these tasks I keep referencing? Implicit Rails features. This post is part of a series of blog posts. So far, there were 2 blog posts, which aim at helping you improve the modularity your Rails applications:

Phusion & Passenger

Yeoman, Grunt, etc. Rails legacy applications. The topic of Rails legacy applications is becoming more popular recently. We, at Arkency, sometimes receive questions whether we can take control over an existing application. It's never an easy decision. Legacy apps contain legacy bugs, which can quickly become "our" bugs. They often have no tests, or just failing tests. Rails Tutorial : 01 Toolchain.