http://tinyurl.com/josh-lightning-talks
- Present trip to RDRC
- How to contribute to F/OSS
- Ruby method overloading
Chem timer- Land of Lisp book review
- Metaprogramming Ruby book review
- Cucumber Watir example
| From: James Edward Gray II <james@grayproductions.net> | |
| To: <%= to %> | |
| Subject: Addressing Needs | |
| <%= to[/\w+/] %>: | |
| Just wanted to send a quick note assuring that your needs are being | |
| addressed. | |
| I want you to know that my team will keep working on the issues, |
| # my submission for http://rubylearning.com/blog/2010/07/31/rpcfn-cycle-tracks-12/ | |
| # | |
| # update: I hadn't realized it, but this challenge actually ended today. | |
| # Mine was very similar to the guy who won, which you can see at http://gist.github.com/502083 | |
| # (though he included a very nice 1.9 only solution) | |
| def skip_tracks( ary , i ) | |
| i %= ary.size | |
| ary.replace ary[i..-1]+ary[0...i] | |
| end |
| # http://gist.github.com/571709 | |
| # Okay, after class, I cleaned it up just a small amount, and added bigdecimal | |
| # Other than that, this was written in class by team Riskies, if you can't tell, our team was pretty much the best. | |
| require 'rubygems' | |
| require 'sinatra' | |
| require 'bigdecimal' # use big decimals, because IEEE floats are imprecise, and we are working with money | |
| class String | |
| def to_bd |
| #include <stdint.h> | |
| #include <stdio.h> | |
| int main() | |
| { | |
| int i; | |
| // signed | |
| printf("int8_t, bytes: %ld, signed: true\n",sizeof(int8_t)); | |
| for( i = -64*4 ; i < -64*3 ; ++i ) { |
| <!-- It is probably easier to read if you initialize item_images to be an empty hash --> | |
| <% @item.item_images ||= Hash.new %> | |
| <% @item.item_images.each do |key, image| %> | |
| <img src="<%= image.path %>" width="397" <% if key != 0 %>style="display:none"<% end %> /> | |
| <% end %> | |
| <!-- Or return a default value for when it is nil --> | |
| <% (@item.item_images || Hash.new).each do |key, image| %> | |
| <img src="<%= image.path %>" width="397" <% if key != 0 %>style="display:none"<% end %> /> |
| #!/usr/bin/env ruby -Ku | |
| # take countries by atheism http://en.wikipedia.org/wiki/Demographics_of_atheism | |
| # compare to countries by homicide rate http://en.wikipedia.org/wiki/List_of_countries_by_intentional_homicide_rate | |
| # calculations and analysis down below | |
| countries = { | |
| "Sweden"=>{:atheism=>85, :crime=>1.17}, | |
| "Denmark"=>{:atheism=>80, :crime=>1.11}, |
| $ for ver in `rvm list strings` ; do rvm use $ver ; ruby bm.rb ; echo ; echo ; done | |
| Using /Users/josh/.rvm/gems/jruby-1.5.2 | |
| user system total real | |
| for loop 1.435000 0.000000 1.435000 ( 1.435000) | |
| while loop 1.034000 0.000000 1.034000 ( 1.034000) | |
| times loop 1.126000 0.000000 1.126000 ( 1.126000) | |
| Using /Users/josh/.rvm/gems/jruby-1.5.3 | |
| user system total real |
| # fx must be started as follows | |
| # /Applications/Firefox.app/Contents/MacOS/firefox-bin -jssh | |
| # watir example | |
| require 'firewatir' | |
| fx = FireWatir::Firefox.new | |
| fx.goto 'pastie.org' | |
| text = fx.text_field :id , 'paste_body' | |
| text.set "hello, world!" |
http://tinyurl.com/josh-lightning-talks
| #include <stdio.h> | |
| #include <string.h> | |
| typedef struct { | |
| char* name; | |
| int (*pointer)( int arg ); | |
| } Method; | |
| typedef struct { | |
| Method* methods; |