background preloader

Ruby QuickRef

Ruby QuickRef
Table of Contents Language General Tips These are tips I’ve given over and over and over and over… Use 2 space indent, no tabs. See for more. General Syntax Rules Comments start with a pound/sharp (#) character and go to EOL. Reserved Words alias and BEGIN begin break case class def defined? Types Basic types are numbers, strings, ranges, regexen, symbols, arrays, and hashes. Numbers 1231_234123.451.2e-30xffff 0b01011 0377 ? Strings In all of the %() cases below, you may use any matching characters or any single character for delimiters. %[], %!! 'no interpolation'"#{interpolation}, and backslashes\n"%q(no interpolation)%Q(interpolation and backslashes)%(interpolation and backslashes)`echo command interpretation with interpolation and backslashes`%x(echo command interpretation with interpolation and backslashes) Backslashes: Here Docs: Encodings: Waaaay too much to cover here. Symbols Internalized String. Ranges 1..101...10'a'..' Regexen "r" Related:  Ruby Development

Ruby on Rails Guides Programmation Ruby/Types standards Un livre de Wikilivres. << Retour au sommaire Nous allons voir ici tous les types que nous pouvons considérer comme "standards", dans le sens où nous les retrouvons dans la plupart des langages, et que ceux-ci sont directement intégrés à l'interpréteur (built-in). Néanmoins il ne faut pas perdre de vue qu'il s'agit en réalité d'objets. Pour rappel les méthodes dont le nom se termine par ! Chaîne de caractères[modifier | modifier le wikicode] En ruby les chaînes de caractères sont représentées par l'objet "String". Créer une chaîne de caractères[modifier | modifier le wikicode] En ruby il existe une multitude de manière de créer une chaîne de caractères, par exemple en créant une instance de l'objet String : maChaine = String.new("Une chaîne de caractères") Mais le moyen le plus courant de créer une chaîne est de la placer entre simple quote (') ou entre double quote ("). Dans une chaîne de caractère \ à une valeur particulière, elle permet de placer un caractères d'échappements. %q! "Ho!

Documentation Here you will find pointers to manuals, tutorials and references that will come in handy when you feel like coding in Ruby. Installing Ruby Unless you only want to try Ruby in the browser (see the links below) you need to have Ruby installed on your computer. This should output some information on the installed Ruby version. Getting Started Try Ruby! An interactive tutorial that lets you try out Ruby right in your browser. Ruby Koans The Koans walk you along the path to enlightenment in order to learn Ruby. RubyMonk Discover Ruby idioms, learn lessons and solve problems, all in your browser! Hackety Hack The little coder’s starter kit. Why’s (Poignant) Guide to Ruby An unconventional but interesting book that will teach you Ruby through stories, wit, and comics. Ruby in Twenty Minutes A nice tutorial covering the basics of Ruby. Ruby from Other Languages Coming to Ruby from another language? Learning Ruby Ruby Essentials Learn to Program Learn Ruby the Hard Way Manuals Programming Ruby RubyDoc.info

Dev Center | Collaborating with Others cli collaboration Table of Contents Adding collaborators Other developers (identified by email address) can be invited to collaborate on your app: heroku sharing:add joe@example.com Adding joe@example.com to myapp collaborators... done When you invite a collaborator, they’ll be sent an email to let them know they were granted access to the app. Collaborator privileges All actions are supported for collaborators as they are for app owners except for the following, which are only support for app owners: Adding or removing paid add-onsDeleting or renaming the appViewing invoices These are the only actions that are restricted. Accessing an app as a collaborator When someone grants you access to an app, you will receive an email with the app name and some other information to help you get started: Next you should clone the app locally. At this point you can use git push heroku to deploy local commits. Viewing collaborators Use the heroku sharing command to see the list of current collaborators:

Ruby From Other Languages When you first look at some Ruby code, it will likely remind you of other programming languages you’ve used. This is on purpose. Much of the syntax is familiar to users of Perl, Python, and Java (among other languages), so if you’ve used those, learning Ruby will be a piece of cake. This document contains two major sections. The first attempts to be a rapid-fire summary of what you can expect to see when going from language X to Ruby. The second section tackles the major language features and how they might compare to what you’re already familiar with. What to Expect: Language X to Ruby Important Language Features And Some Gotchas Here are some pointers and hints on major Ruby features you’ll see while learning Ruby. Iteration Two Ruby features that are a bit unlike what you may have seen before, and which take some getting used to, are “blocks” and iterators. some_list.each do |this_item| # We're inside the block. # deal with this_item.end Everything has a value Everything is an Object

Rubular: a Ruby regular expression editor and tester Getting Started with Nokogiri | Engine Yard Ruby on Rails Blog We're decided to mix up the Engine Yard blog a little and invite some community members to contribute guest posts. This one (our first!) is from [Aaron Patterson]( -- a long-time member of the Ruby community, and the creator of Nokogiri. He hacks with the developers of Seattle.rb, and travels the world to speak about Nokogiri and other Ruby topics at industry conferences and events. Nokogiri is a library for dealing with XML and HTML documents. Getting Nokogiri installedBasic document parsingBasic data extraction Hopefully by the end of this article you will also be able to use and enjoy Nokogiri on a day to day basis too! Installation Nokogiri is actually a wrapper around Daniel Veillard's excellent HTML/XML parsing library written, libxml2. I recommend installing libxml2 on OS X from macports. To install libxml2 from macports: $ sudo port install libxml2 libxslt Then to install nokogiri: $ sudo gem install nokogiri And that should be it! Linux On Fedora: On Ubuntu:

Redsn0w 0.9.9b8 Released Published on 11-03-2011 02:49 PM Redsn0w 0.9.9b8 is fully compatible with the iOS 5.0.1 Beta released to developers yesterday. Yesterday, Apple pushed out the iOS 5.0.1 Beta to developers which has fixed numerous bugs in iOS 5 and brings the beloved multitasking gestures back to the original iPad. It was reported that iOS 5.0.1 could have been jailbroken with redsn0w 0.9.9b7, although you would need to point redsn0w to the iOS 5.0 firmware file, and the jailbreak was tethered. Originally Posted by Dev-Team Blog Redsn0w version 0.9.9b8 will natively recognize the 5.0.1 beta that Apple let developers start testing this week (so you don’t have to play the “point at 5.0 IPSW” trick). For those iPhone 3GS and iPhone 4 users who preserve their baseband, the Mac version can also produce the NO_BB_* custom IPSW's for 5.0.1. This is still a tethered jailbreak for all except old-bootrom 3GS users. This new update brings support for the iOS 5.0.1 Beta. You can download Redsn0w 0.9.9b8 for Mac, here.

Heroku | Cloud Application Platform

Related: