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 'rubygems' | |
| require 'redis' | |
| def random_redis | |
| 100.times do | |
| rand_key = "key_#{rand(100)}" | |
| rand_val = rand | |
| if (rand_val < 0.33) |
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 'rubygems' | |
| require 'active_record' | |
| `/usr/local/mysql/bin/mysql -u root unicode_test < create_test_db.sql` | |
| ar_confs = { | |
| "mysql" => { | |
| "adapter" => "mysql2", | |
| "database" => "unicode_test", | |
| "username" => "root", |
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
| ### Installation Notes for Thrift / Scribe on Ubuntu Lucid (v10.04) | |
| ### Step 1: Install required tools | |
| sudo apt-get install libboost-dev libevent-dev python-dev automake pkg-config libtool flex bison | |
| sudo apt-get install php5-dev | |
| sudo apt-get install ant | |
| sudo apt-get install openjdk-6-jdk | |
| sudo apt-get install bjam | |
| sudo apt-get install libboost-all-dev |
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/bash | |
| # This is the process for installing Thrift, Scribed and the php extension on Ubuntu | |
| # [email protected] | |
| set -e | |
| # install dependancies | |
| aptitude install libboost1.40-dev libboost-filesystem1.40-dev libevent-dev build-essential flex bison libtool libevent-dev php5-dev pkg-config | |
| # install thrift from source | |
| cd /usr/local/src |
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 = 1000.times.inject([]) { |m, k| m << rand } | |
| sparkline = Sparkline.new( data, :height => 100, :width => 500 ) | |
| puts sparkline.google_img_url | |
| # => "http://chart.apis.google.com/chart?chxt=r,x,y&chd=t:41.5,34.3,63.4,45.0,50.5,35.7,40.6,54.9,62.0,60.6,53.2,44.9,62.4,61.8,53.5,58.5,60.4,64.6,64.5,49.8,49.3,61.4,46.4,50.8,36.1,46.5,52.8,39.7,44.4,42.3,57.6,45.6,34.1,49.0,64.1,61.4,59.9,34.0,43.9,44.8,40.4,34.0,60.3,36.8,56.1,63.1,52.7,39.6,51.9,39.0&chxs=0,990000,11,0,_|1,990000,1,0,_|2,990000,1,0,_&chm=o,990000,0,50,5&cht=lc&chxl=0:|0.17|1:||2:||&chco=336699&chxp=0,38.9904542844803&chls=1,1,0&chs=500x100" |
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
| FB.provide('UIServer.Methods', { | |
| 'permissions.request': { | |
| size : { width: 575, height: 240 }, | |
| url : 'connect/uiserver.php', | |
| transform : function(call) { | |
| if (call.params.display == 'dialog') { | |
| call.params.display = 'iframe'; | |
| call.params.channel = FB.UIServer._xdChannelHandler( | |
| call.id, | |
| 'parent.parent' |
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
| LIKELY_TEMP_ERRORS = [AWS::S3::NoSuchKey, ActiveRecord::RecordNotFound] | |
| ## => [AWS::S3::NoSuchKey, ActiveRecord::RecordNotFound] | |
| error = AWS::S3::NoSuchKey.new("foo", "bar") | |
| ## => #<AWS::S3::NoSuchKey: foo> | |
| LIKELY_TEMP_ERRORS.include?(error.class) | |
| ## => true |
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
| if Rails.env.test? | |
| RAILS_DEFAULT_LOGGER.debug "VBC patching" | |
| class Mixpanel | |
| def track! | |
| RAILS_DEFAULT_LOGGER.debug "VBC RETURNING" | |
| end | |
| end |
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
| length = 260240 | |
| puts "length = #{length}" | |
| ENV["FOO"] = "a" * length | |
| ls_out = `ls` | |
| puts "length = #{ls_out.length} - #{ls_out}" |
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
| irb(main):021:0> ENV | |
| => {"SHELL"=>"/bin/bash", "TERM"=>"screen", "SSH_CLIENT"=>"24.5.83.171 51266 22", "SSH_TTY"=>"/dev/pts/7", "USER"=>"posterous", "LS_COLORS"=>"no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.svgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01 |