Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8" ?>
<skin name="Snow" author="Michael Swiger" version="1.0" loader="1.0">
<widget name="Button">
<style>
<image name="Background" source="snow.png" x="0" y="0" width="20" height="20" />
<font source="fonts/kewlstuff.ttf" color="#FF0000" size="12" />
</style>
<style name="Hover">
<image name="Background" source="snow.png" x="0" y="20" width="20" height="20" />
</style>
[INFO] Launching Android emulator...one moment
[DEBUG] From: /home/max/Applications/android-sdk-linux_86/tools/emulator
[DEBUG] SDCard: /home/max/.titanium/android2.sdcard
[DEBUG] AVD ID: 6
[DEBUG] AVD Skin: WQVGA432
[DEBUG] SDK: /home/max/Applications/android-sdk-linux_86
[DEBUG] /home/max/Applications/android-sdk-linux_86/tools/emulator -avd titanium_6_WQVGA432 -port 5560 -sdcard /home/max/.titanium/android2.sdcard -logcat '*:d *' -no-boot-anim -partition-size 128
[TRACE] emulator: warning: opening audio input failed
[TRACE]
[INFO] Building Scrum Holdem for Android ... one moment
var db = openDatabase("example_db", "", "Example Database", 100000);
// openDatabase(db name, required version (blank string for n/a), human-readable database name, expected size in bytes)
db.changeVersion("", "1", function(t){
t.executeSql("create table ...");
});
/* Note:
openDatabase actually takes one more (optional) argument -- a callback in case the database was /just/ created, for you to call changeVersion and provide an initial schema. However, since this post is more interested in migrations, and because I don't want the initial migration to be a "special case", I'm pretending like it doesn't exist. It's there if you want it, of course.
*/
module Recipe
class BeerShiitakeCabbageSoup < Recipe::Soup
author = "Esther"
programmer = "Max"
note.from_author.message = "This is a completely original Esther recipe inspired by the leftovers in my fridge. Max and I both loved it, so I hope you enjoy :-)"
assemble :ingredients do
peas = Pea.buy(:quantity => 1..2.cups, :variety => :black_eyed, :condition => :dry)
onions = Onion.buy(:quantity => 0.5).and_prepare_by(:chop)
cabbage = Cabbage.buy(:quantity => (1.5)..2.cups).and_prepare_by(:slice => :ribbons)
Basic text.
%h1 Hey, this is in an h1
%p The following line is a paragraph consisting of a single instance variable: @text
%p= @text
%p If you want to embed code/Ruby in the middle of a line, you need ==.
%p== Like for example, this: #{@my_var}
%h1 Feeling Friendly
%form{:action => "/feeling", :method => "post"}
%legend
A simple question
%p
%label{:for => ""} How are you feeling today?
%input{:type => "textbox", :name => "feeling", :id => "feeling"}
%p
%input{:type => "submit", :value => "Submit!"}
require 'rubygems'
require 'sinatra'
require 'haml'
get '/my_template' do
@weather = "sunny"
@temperature = 80
haml :weather
end
require 'rubygems'
require 'sinatra'
require 'haml'
get '/my_template' do
@weather = "sunny"
@temperature = 80
haml :weather
end
require 'rubygems' # skip this line in Ruby 1.9
require 'sinatra'
get '/' do
"Hello, world!"
end
>> hydra = Typhoeus::Hydra.new
=> #<Typhoeus::Hydra:0x2b2b902130e0 @multi=#<Typhoeus::Multi:0x2b2b90213068>, @retrieved_from_cache={}, @max_concurrency=200, @memoize_requests=true, @memoized_requests={}, @running_requests=0, @stubs=[], @easy_pool=[#<Typhoeus::Easy:0x2b2b90212fc8>, #<Typhoeus::Easy:0x2b2b90212f50>, #<Typhoeus::Easy:0x2b2b90212eb0>, #<Typhoeus::Easy:0x2b2b90212e10>, #<Typhoeus::Easy:0x2b2b90212d70>, #<Typhoeus::Easy:0x2b2b90212cd0>, #<Typhoeus::Easy:0x2b2b90212c30>, #<Typhoeus::Easy:0x2b2b90212b90>, #<Typhoeus::Easy:0x2b2b90212af0>, #<Typhoeus::Easy:0x2b2b90212a50>], @queued_requests=[]>
>> a = Typhoeus::Request.new("https://mail.google.com"); hydra.queue(a); hydra.run; a.response.code
=> 200
>> a = Typhoeus::Request.new("https://mail.google.com"); hydra.queue(a); hydra.run; a.response.code
=> 0
>> (hydra.send :instance_variable_set, :@easy_pool, [].fill(Typhoeus::Easy.new, 0, 5))
=> [#<Typhoeus::Easy:0x2b2b90206d40>, #<Typhoeus::Easy:0x2b2b90206d40>, #<Typhoeus::Easy:0x2b2b90206d40>, #<Typhoeu