background preloader


Facebook Twitter

RubyMonk - Ruby Primer - Iteration. RVM: Ruby Version Manager - RVM Examples. $ rvm help # Documentation Index RVM version $ rvm -v rvm 1.11.7 (stable) by Wayne E.

RVM: Ruby Version Manager - RVM Examples

Seguin Use a particular Ruby. $ rvm use 1.8.6 Equivalently (because of RVM's defaults): Bootstrap 3: Change Stacking Order. Changing the stacking order of columns in Twitter’s Bootstrap 3 is actually easier than you may think.

Bootstrap 3: Change Stacking Order

Excited yet? Calm down. Below is an example situation where you may want to change the stacking order. We have a nice 2 column row that has text on the left and an image on the right. Building Awesome Rails APIs: Part 1. After teaching an Advanced Rails class last week, I realized that we use a lot of patterns internally to build great APIs in Rails that many people don’t know about.

Building Awesome Rails APIs: Part 1

We didn’t invent most of them, but we use them with great success, so we need to start sharing. Namespace your API. Best In Place TEST APP. Go back to USERS Click to edit Try the features of Best In Place: Try giving wrong email values or too short address, inputs to see server errors.

Best In Place TEST APP

Click on newsletter to change a boolean value Click on country to change the value in a collection of values Use the external handler to change the value of the name Try making changes inside inputs or textareas and then press the ESC key to recover the old value Try creating HTML only in the description textarea, where the option :sanitize is set to false, in the others the input is sanitized. #296 Mercury Editor. Gsub (String) Replacing with "\" and match If you’re trying to place a “" in front of your matches, you’ll quickly see that it is a pain in the ass to add the quoting in the replacement string.

gsub (String)

Here’s an example: v = "Foo Bar! " #390 Turbolinks. Turbolinks can make your Rails app feel faster by using JavaScript to replace the page content when clicking a link.

#390 Turbolinks

It will be default in new Rails 4.0 applications, but here I show how to use it in Rails 3 and mention some of the gotchas. Download: source codeProject Files in Zip (63.9 KB)mp4Full Size H.264 Video (21.5 MB)m4vSmaller H.264 Video (9.41 MB)webmFull Size VP8 Video (10.9 MB)ogvFull Size Theora Video (22.9 MB) Introducing Turbolinks for Rails 4.0 - GeekMonkey. David Heinemeier Hansson, creator of Ruby on Rails, recently announced on Twitter that a feature called Turbolinks will ship as default-on in the Gemfile of Ruby on Rails 4.0.

Introducing Turbolinks for Rails 4.0 - GeekMonkey

Turbolinks is already powering the mobile website of Basecamp. Someone at Hacker News posted a link to the Turbolinks repository on Github and titled it: Turbolinks for Rails (like pjax) So what is PJAX and what does Turbolinks do differently? HTML5 introduced several new APIs to JavaScript, one being the History interface. pushState allows JavaScript to store arbitrary data into the session history, combined with a title and an optional URL. PJAX is a portmanteau of the terms pushState and AJAX. Kossnocorp/jquery.turbolinks. Jquery - Character countdown like on twitter. HTML5 for the Mobile Web: Canvas. Next up in our HTML5 for Mobile Web series is the canvas element.

HTML5 for the Mobile Web: Canvas

Canvas is particularly interesting since it facilitates the use of graphics without the need for any plugins or other technologies other than JavaScript and CSS. Quite a few new elements were introduced in HTML5, although few have received as much attention as canvas. Several elements have been removed too, including some of the most infamous ones such as big, font, and frameset. For a full reference of new and removed HTML5 elements, please see this page In this article, we'll take a look at how to setup a canvas suitable for use on a mobile device, and then we'll look at how we can handle images, text, drawing arc and curves, and various transformations that can be performed. Setting up your canvas. How to Setup a Production Server for Rails 4 // Rob McLarty. Choose a Service Provider I already had an account with Media Temple, so I thought that keeping all my cloud junk together and staying with MT would make things easier to manage, for me personally.

How to Setup a Production Server for Rails 4 // Rob McLarty

I'm not getting paid to endorse MT in any way. Without my existing relationship I could have just as easily gone with something like Rackspace, Linode, or even Heroku. Prologue. Pricing. Introduction to Database Design (on Rails): Part II. In a previous post, I explained the fundamentals of database design.

Introduction to Database Design (on Rails): Part II

This guide will cover the second half of that topic: how to make the database work with Rails. Before reading this you should have a good understanding of what a database is and how to organize one. Rails is a framework that sits on top of the programming language Ruby. The framework speeds up web development by filling in code that you'd otherwise write from scratch on every new project. A component of this is ActiveRecord, a subset of Rails that acts as the bridge between your database and your Ruby code. A Guide to Active Record Associations. 1 Why Associations? Why do we need associations between models? Ruby on Rails Tutorial Sample App. Ruby Primer - Loops in Ruby. Loops are programming constructs that help you repeat an action an arbitrary number of times. The methods Array#each, Array#select etc. are the most frequently used loops since the primary use of loops is to iterate over or transform a collection, something that we'll learn in the chapter on "Arrays in Ruby.

" Here we will cover two basic looping constructs you can use to solve most other looping requirements that may come up. Infinite Loops Infinite loops keep running till you explicitly ask them to stop. They are syntactically the simplest to write. Loop do puts "this line will be executed for an infinite amount of time" end The example above does not have a termination condition and hence will run till the process is stopped. Learn Web Development with the Ruby on Rails Tutorial. Michael Hartl Contents. Scaffolding. Need reasons to love Bootstrap? Look no further. By nerds, for nerds. Built at Twitter by @mdo and @fat, Bootstrap utilizes LESS CSS, is compiled via Node, and is managed through GitHub to help nerds do awesome stuff on the web. Made for everyone. Bootstrap was made to not only look and behave great in the latest desktop browsers (as well as IE7!) Learn Ruby with the Neo Ruby Koans.

Learn Web Development with the Ruby on Rails Tutorial. Michael Hartl Contents. Ruby in Twenty Minutes. Now let’s create a greeter object and use it: irb(main):035:0> g ="Pat")=> #<Greeter:0x16cac @name="Pat">irb(main):036:0> g.say_hiHi Pat! Ruby Primer - Modules as Namespaces.