JSConf.eu opening song - JavaScript Will Listen - Bella Morningstar
- Plask - Dean McNamee
- Plask
| run ->(e){ p=Hash[*e['QUERY_STRING'].split(/[&=]/)]; [200, {'Content-type'=>'text/html'}, ["Hello #{p['name']}!"]] } |
| # This allows to use a numeric or a lambda | |
| def retry_upto(max_retries = 1, options = {}) | |
| begin | |
| return yield if ((max_retries -= 1) > 0) | |
| rescue (options[:rescue_only] || Exception) | |
| if options[:patience] | |
| if options[:patience].is_a?(Numeric) | |
| options[:wait] = options[:wait] * options[:patience] | |
| else |
| # Ruby `retry` with steroids: | |
| # | |
| # - retry up to 5 times without waiting between them and retrying after any exception | |
| # | |
| # retry_upto(5) do ... end | |
| # | |
| # - retry up to 5 times, waiting 2 seconds between retries | |
| # | |
| # retry_upto(5, :wait => 2) do ... end | |
| # |
| # Usage (works only with default Rack::Test driver): | |
| page.go_back |
| /*! | |
| * Backbone Module Manager - v0.1pre - 9/9/2011 | |
| * http://benalman.com/ | |
| * | |
| * Copyright (c) 2011 "Cowboy" Ben Alman | |
| * Dual licensed under the MIT and GPL licenses. | |
| * http://benalman.com/about/license/ | |
| */ | |
| function ModuleManager(fn) { |
| # | |
| # A basic, synthetic benchmark of the impact HTTP client has | |
| # on the speed of talking to ElasticSearch in the Tire gem. | |
| # | |
| # In general, Curb seems to be more then two times faster the RestClient, in some cases it's three | |
| # to five times faster. I wonder if keep-alive has anything to do with it, but it probably does. | |
| # | |
| # Run me with: | |
| # $ git clone git://github.com/karmi/tire.git | |
| # $ cd tire |
| #!/usr/bin/env ruby | |
| =begin | |
| README | |
| ====== | |
| Download any youtube video, in the original format ogg without | |
| loosing quality, and also convert a mp3 from the ogg. | |
| You have to decide if the mp3 quality is enough for you. Or you | |
| can adjust the parameters of the conversion if you need the mp3 |
| #!/usr/bin/env ruby | |
| # jazzfonica.rb for Mac OS X | |
| # Scans the visible networks for JAZZTEL_XXXX or WLAN_XXXX and calculates the password | |
| # Ported from PHP example at http://kz.ath.cx/wlan/codigo.txt | |
| # Download and execute with ruby (e.g. ruby jazzfonica.rb) from a Terminal | |
| #ported to ubuntu from https://gist.github.com/1024587 | |
| #it will ask for sudo privileges. | |
| #if your wlan card is not "wlan0" change the "my_wifi_card" variable |