background preloader

RubySource » For Ruby & Rails Developers

RubySource » For Ruby & Rails Developers

Must-Read Ruby Links Every programming language has a number of works you just cannot not read. Perl has the camel book, C++ has "The C++ Programming Lanugage," etc. Ruby does have it's own dead tree you cannot not read, "Programming Ruby: The Pragmatic Programmer's Guide," the so-called "pickaxe book," but that's covered so many places and recommended by everyone. Ruby Koans - A "koan" is a story or dialog crafted to make a student think. The Ruby Homepage - This might seem like a no-brainer, the Ruby homepage. Stack Overflow - In the same vein as the Ruby mailing lists is Stack Overflow. Ruby-Doc.org - Yes, you probably have Ruby documentation on your system already. Ruby Inside - Peter Cooper has been slavishly updating this blog for years now. Ruby Flow - Another one from Peter Cooper, but this time anyone can submit. Ruby Internals presentation - This is a presentation done by Patrick Farley shows you how Ruby really works. Ruby Hacking Guide - Here's another work that digs real deep into Ruby.

jQuery: The Write Less, Do More, JavaScript Library Ruby core classes aren't thread safe | Jesse Storimer's Blog A few days I shared a quote on Twitter: > Ruby Arrays aren't thread-safe, [...] MRI's threading implementation accidentally makes them thread-safe. It saw a bunch of retweets and discussion, but I daresay that the nuances of that statement were lost on a lot of developers. That's a big question, and I think the answer lies in education. Let's dig in with an example. Here's a very simple inventory tracking class: class Inventory def initialize(stock_levels) @stock = stock_levels end def decrease(item) @stock[item] -= 1 def [](item) @stock[item] It's trivially simple. inventory = Inventory.new(:tshirt => 200, :pants => 340, :hats => 4000) inventory.decrease(:hats) inventory.decrease(:pants) Now let me ask you this: is this thread-safe? Let's exercise this code to find out. 4000.times do puts inventory[:hats] Running this code on MRI 1.9.3, the answer is, predictably, 0. Now let's exercise the code again, with threads this time. threads = Array.new 40.times do threads << Thread.new do 100.times do 400.times do

flyerhzm/bullet The Ruby Programming Language Ruby Programming Ruby is an interpreted, object-oriented programming language. Its creator, Yukihiro Matsumoto, a.k.a “Matz,” released it to the public in 1995. Its history is covered here. The book is currently broken down into several sections and is intended to be read sequentially. Table of Contents[edit] Getting started[edit] Overview Installing Ruby Ruby editors Notation conventions Interactive Ruby Mailing List FAQ Basic Ruby[edit] Hello world Strings Alternate quotes Here documents Encoding Introduction to objects Ruby basics Data types — numbers, strings, hashes and arrays Writing methods Classes and objects Exceptions Ruby Semantic reference[edit] See also some rdoc documentation on the various keywords. Built in Classes[edit] This is a list of classes that are available to you by default in Ruby. Available Standard Library Modules[edit] These are parts of Ruby that you have available (in the standard library, or via installation as a gem). Other Libraries[edit] Database Interface Modules GUI Libraries[edit] RubyDoc

Four Guidelines That I Feel Have Improved My Code I have been thinking a lot about isolation, dependencies and clean code of late. I know there is a lot of disagreement with people vehemently standing in both camps. I certainly will not say either side is right or wrong, but what follows is what I feel has improved my code. I post it here to formalize some recent thoughts and, if I am lucky, get some good feedback. Before I rush into the gory details, I feel I should mention that I went down this path, not as an architecture astronout, but out of genuine pain in what I was working on. My models were growing large. I started watching Gary Bernhardt’s Destroy All Software screencasts. On top of DAS, I started reading everything I could on the subject of growing software, clean code and refactoring. I was literally prowling about like a lion, looking for the next book I could devour. Over the past few months as I have tried to write better code, I have definitely learned a lot. Guideline #1. The problem is context. Create More Classes

Devoth's HEX 2 RGBA Color Calculator Ruby Hacking Guide

Related: