The Back of the Napkin: Solving Problems and Selling Ideas with Pictures By: Dan Roam
Designing Interactions By: Bill Moggridge
Presentation Techniques By: Dick Powell
# | |
# This class represents a path in the tree. It stores the positions along the x axis | |
# as a function of the depth and the sum of the leaves along the path | |
# | |
class Path | |
attr_accessor :path | |
attr_accessor :sum | |
def initialize(parent, xpos, value) | |
if parent |
## | |
# A sitemap has an URL, and holds a collection of pages to be validated | |
# | |
module W3Clove | |
require 'open-uri' | |
require 'nokogiri' | |
class Sitemap | |
attr_accessor :url |
/* | |
* call-seq: | |
* ary[index] -> obj or nil | |
* ary[start, length] -> new_ary or nil | |
* ary[range] -> new_ary or nil | |
* ary.slice(index) -> obj or nil | |
* ary.slice(start, length) -> new_ary or nil | |
* ary.slice(range) -> new_ary or nil | |
* | |
* Element Reference---Returns the element at _index_, |
The Back of the Napkin: Solving Problems and Selling Ideas with Pictures By: Dan Roam
Designing Interactions By: Bill Moggridge
Presentation Techniques By: Dick Powell
require 'benchmark' | |
ary = 1000.times.collect { rand(2000) } | |
Benchmark.bm(10) do |x| | |
x.report { ary.select { |e| ary.count(e) > 1 }.uniq } | |
x.report { ary.group_by {|e| e}.select { |k, v| v.size > 1 }.map(&:first) } | |
x.report { ary.uniq.select { |i| ary.count(i) > 1 } } | |
x.report { ary.uniq.select { |i| ary.delete_at(ary.index(i)) && ary.delete_at(ary.index(i) || ary.length) } } | |
x.report { ary.uniq.delete_if { |i| ary.one? { |elm| elm == i } } } |
# In Ruby you can use def anywhere in your code, but its behavior | |
# depends on the context in which it is used. | |
# Outside a class definition def creates singleton methods | |
foo = Object.new | |
# This will create a singleton method in FOO | |
def foo.speak | |
puts "foo" |
# encoding: utf-8 | |
substitutions = Proc.new do |c| | |
case c | |
when 'ñ' then 'n' | |
when 'í' then 'i' | |
else '?' | |
end | |
end |
"I am a freelance Ruby and Rails developer". When I talk with my geek friends, everyone understands what I do and they have a reasonable understanding of how I spend my day. But sometimes, less technical people ask me what I do for a living and then I tend to dumb down the answer: "I am a programmer, I usually build websites.". Oh -they say- my nephew also make websites, he even built me a blog in Blogger.
Err... yes, but that hardly has anything to do with what I do for a living.
There are many different kinds of websites, built with different technologies, and depending on the site and the technology used to build it, they are made by one kind of professional or another. The craft of building a website comprises many different disciplines, and professionals usually specialize in just one part of the process. Although I do many different things, my specialization is mainly programming dynamic websites using Ruby and Rails.
In this article I want to
This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.
You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf
using homebrew.
alberto@Albertos-iMac ~/dev/loadtime $ rails -v | |
Rails 4.0.2 | |
alberto@Albertos-iMac ~/dev/loadtime $ ruby -v | |
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.5.0] | |
alberto@Albertos-iMac ~/dev/loadtime $ time rails runner "puts 'hello'" | |
hello | |
rails runner "puts 'hello'" 1.16s user 0.16s system 99% cpu 1.330 total |