This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> | |
| </head> | |
| <body> | |
| <div id="div1">block 1</div> | |
| <script type="text/javascript"> | |
| $(document).ready(function() { alert($("#div2").text()) }) | |
| </script> | |
| <div id="div2">block 2</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/env ruby | |
| require 'open-uri' | |
| require 'json' | |
| require 'uri' | |
| u='http://ajax.googleapis.com/ajax/services/search/local' | |
| q="v=1.0&key=#{ENV['GOOGLE_API_KEY']}&mrt=localonly&rsz=8&sll=32.899594,-117.198722&q=food" | |
| q << URI.encode(" #{ARGV[0]}") unless ARGV.empty? | |
| begin | |
| places = (1..100).to_a.shuffle.shift(10).reduce([]) do |r,s| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def foo(arg1, arg2, *arg3) | |
| @arg1 = arg1 | |
| @arg2 = arg2 | |
| @arg3 = arg3 | |
| end | |
| def bar(arg1, arg2, arg3 = nil) | |
| @arg1 = arg1 | |
| @arg2 = arg2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'redis' | |
| require 'benchmark' | |
| n = 10_000 | |
| r = Redis.new | |
| o = (1..100).to_a | |
| list_k = "list" | |
| string_k =" string" | |
| o.each { |i| r.lpush list_k, i } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Adapted from Dr. Watson's 5.5.8 formula | |
| # https://github.com/dctrwatson/homebrew/blob/5fe26cbc27eceb0955836f9b5434c3ed6ef0de76/Library/Formula/mysql55.rb | |
| require 'formula' | |
| class Mysql55 < Formula | |
| homepage 'http://dev.mysql.com/doc/refman/5.5/en/' | |
| url 'http://mysql.mirrors.pair.com/Downloads/MySQL-5.5/mysql-5.5.9.tar.gz' | |
| md5 '701c0c44b7f1c2300adc0dc45729f903' | |
| depends_on 'readline' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /usr/local/rvm/gems/ruby-1.9.1-p378/gems/chef-0.9.14/lib/chef/node/attribute.rb:428:in `method_missing': Attribute riak is not defined! (ArgumentError) | |
| from /usr/local/rvm/gems/ruby-1.9.1-p378/gems/chef-0.9.14/lib/chef/node.rb:319:in `method_missing' | |
| from /tmp/vagrant-chef/cookbooks-0/riak/attributes/bitcask.rb:20:in `from_file' | |
| from /usr/local/rvm/gems/ruby-1.9.1-p378/gems/chef-0.9.14/lib/chef/mixin/from_file.rb:30:in `instance_eval' | |
| from /usr/local/rvm/gems/ruby-1.9.1-p378/gems/chef-0.9.14/lib/chef/mixin/from_file.rb:30:in `from_file' | |
| from /usr/local/rvm/gems/ruby-1.9.1-p378/gems/chef-0.9.14/lib/chef/node.rb:577:in `block (2 levels) in load_attributes' | |
| from /usr/local/rvm/gems/ruby-1.9.1-p378/gems/chef-0.9.14/lib/chef/node.rb:575:in `each' | |
| from /usr/local/rvm/gems/ruby-1.9.1-p378/gems/chef-0.9.14/lib/chef/node.rb:575:in `block in load_attributes' | |
| from /usr/local/rvm/gems/ruby-1.9.1-p378/gems/chef-0.9.14/lib/chef/node.rb:574:in `each' | |
| from /usr/local/rvm/gems/ruby-1.9.1-p378/gems/chef-0.9.14/lib/che |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rpm -Uvh --force --nosignature --nodigest http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm | |
| rpm -Uvh --force --nosignature --nodigest http://download.elff.bravenet.com/5/i386/elff-release-5-3.noarch.rpm | |
| yum install -y curl ftp rsync sudo time wget which git-core | |
| yum install -y gcc bzip2 make kernel-devel-`uname -r` | |
| yum install -y gcc-c++ zlib-devel openssl-devel readline-devel | |
| yum erase -y wireless-tools gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts | |
| service vboxadd status 2>&1 >> /dev/null | |
| if [ $? -eq 1 ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| str.gsub!(/[\xFF\xFE]/, '').unpack("U*").reduce("") {|s,c| s << c.chr unless c == 0; s } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ---------- isolate ----------- | |
| ruby -risolate/now -e 'p "ok"' > /dev/null 0.33s user 0.07s system 99% cpu 0.407 total | |
| ruby -risolate/now -e 'p "ok"' > /dev/null 0.33s user 0.07s system 99% cpu 0.403 total | |
| ruby -risolate/now -e 'p "ok"' > /dev/null 0.33s user 0.07s system 99% cpu 0.403 total | |
| ruby -risolate/now -e 'p "ok"' > /dev/null 0.33s user 0.07s system 99% cpu 0.402 total | |
| ruby -risolate/now -e 'p "ok"' > /dev/null 0.33s user 0.07s system 99% cpu 0.406 total | |
| ruby -risolate/now -e 'p "ok"' > /dev/null 0.33s user 0.07s system 99% cpu 0.403 total | |
| ruby -risolate/now -e 'p "ok"' > /dev/null 0.33s user 0.07s system 99% cpu 0.402 total | |
| ruby -risolate/now -e 'p "ok"' > /dev/null 0.33s user 0.07s system 99% cpu 0.405 total | |
| ruby -risolate/now -e 'p "ok"' > /dev/null 0.33s user 0.07s system 99% cpu 0.402 total |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data = [-18.9909048405025, -21.1473944485855, -23.605768687356, -25.878602276227, -28.3796678950409, -30.664898779891] | |
| Gchart.bar(:data => data).to_s #=> http://chart.apis.google.com/chart?chd=s:999999&cht=bvs&chs=300x200&chxr=0,-18.9909048405025,-18.9909048405025 |