Alright, let's get started. Create a new Ubuntu 12.04 LTS instance, boot it up, and SSH into the fresh Linode as root. Now update/upgrade your sources and install Git and curl:
apt-get update
apt-get upgrade
| A major: A | |
| A minor: a | |
| A-flat major: A♭ | |
| A-flat minor: a♭ | |
| A-sharp minor: a♯ | |
| B major: B | |
| B minor: b | |
| B-flat major: B♭ | |
| B-flat minor: b♭ | |
| C major: C |
| heycarsten:~ carsten$ gem install rakins | |
| Successfully installed rakins-0.0.1 | |
| 1 gem installed | |
| heycarsten:~ carsten$ rakins install rakins | |
| ,,,, | |
| .' `/\_/\ | |
| ' <@V@> /=========================== | |
| <(((((((((( ) ( \./ <== INSTALLIN' rakins, YO. = | |
| \(''''''\(\( \=========================== | |
| `-"`-" " " |
| require 'benchmark' | |
| require 'time' | |
| SECS_IN_HOUR = 3600 | |
| def while_loop | |
| now = Time.now | |
| ago = now - (SECS_IN_HOUR * 23) | |
| max, count, times = now.to_i, ago.to_i, [] | |
| begin |
| require 'benchmark' | |
| Benchmark.bmbm do |x| | |
| x.report('printf') do | |
| for i in 1..1_000_000 | |
| 3.times.map { '%06x' % rand(0x100000) }.join | |
| end | |
| end | |
| x.report('to_s') do |
| ENV['DATABASE_URL'] ||= lambda { | |
| def config | |
| ActiveRecord::Base.configurations[Rails.env.to_s] | |
| end | |
| def credentials | |
| if (creds = [config['user'], config['password']]).any? | |
| creds.join(':') | |
| else | |
| nil |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Using LCBO API via jQuery</title> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script> | |
| <script src="http://ajax.cdnjs.com/ajax/libs/underscore.js/1.1.4/underscore-min.js"></script> | |
| <script type="text/javascript"> | |
| // Let's make an object in the global namespace that will serve as an API | |
| // wrapper for LCBO API. | |
| var LCBO = new function() { |
| # I had no idea that you could do this: | |
| def attribute(name, type = Ohm::Types::String, klass = Ohm::Types[type]) | |
| # If no 3rd argument is provided then it uses the second argument to key | |
| # the default value. Not super obvious, but now that I know about it, I | |
| # think it's kinda cool :-) |
| # I wanted a simple object factory for use with Ohm, I'm used to factory_girl | |
| # and fabrication. After a few minutes of messing around and trying to get them | |
| # to work with Ohm, I decided to try giving it a whirl myself... | |
| class Factory | |
| def self.factories | |
| @factories ||= {} | |
| end |
| heycarsten:lcbo carsten$ gem list nokogiri | |
| *** LOCAL GEMS *** | |
| nokogiri (1.4.3) | |
| heycarsten:lcbo carsten$ irb | |
| ruby-1.9.2-preview3 > require 'nokogiri' | |
| LoadError: no such file to load -- nokogiri/version_warning | |
| from /Users/carsten/.rvm/gems/ruby-1.9.2-preview3/gems/nokogiri-1.4.3/lib/nokogiri.rb:34:in `require' | |
| from /Users/carsten/.rvm/gems/ruby-1.9.2-preview3/gems/nokogiri-1.4.3/lib/nokogiri.rb:34:in `<top (required)>' |