This file contains 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/bin/env bash | |
apt-get -y update | |
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev | |
cd /tmp | |
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz | |
tar -xvzf ruby-1.9.3-p194.tar.gz | |
cd ruby-1.9.3-p194/ | |
./configure --prefix=/opt/ruby-1.9.3-p194 | |
make | |
make install |
This file contains 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
cd tmp/x86_64-darwin11.3.0/ruby_mapnik/1.9.3 | |
make | |
compiling ../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp | |
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++ | |
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++ | |
In file included from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/../to_from_ruby.hpp:5, | |
from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/Auto_Function_Wrapper.ipp:12, | |
from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/Auto_Function_Wrapper.hpp:826, | |
from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/wrap_function.ipp:10, | |
from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/wrap_function.hpp:338, |
This file contains 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
cd tmp/x86_64-darwin11.3.0/ruby_mapnik/1.9.3 | |
make | |
compiling ../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp | |
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++ | |
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++ | |
In file included from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/../to_from_ruby.hpp:5, | |
from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/Auto_Function_Wrapper.ipp:12, | |
from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/Auto_Function_Wrapper.hpp:826, | |
from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/wrap_function.ipp:10, | |
from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/wrap_function.hpp:338, |
This file contains 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
# Install Postgres 9.2 from https://launchpad.net/~pitti/+archive/postgresql | |
# drop the cluster which gets created during the setup | |
pg_dropcluster --stop 9.2 main | |
# create a backup of your current cluster | |
rsync -a /var/lib/postgresql/9.1 /var/lib/postgresql/9.1.backup | |
# upgrade the the old 9.1 cluster | |
pg_upgradecluster 9.1 main /var/lib/postgresql/9.2 |
This file contains 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
class Api::V1::OpenRateController < ActionController::Metal | |
include ActionController::DataStreaming | |
def show | |
tracking_gif = "GIF89a\x03\x00\x02\x00\x80\x00\x00\xC0\xC0\xC0\x00\x00\x00!\xF9\x04\x01\x00\x00\x00\x00,\x00\x00\x00\x00\x03\x00\x02\x00\x00\x02\x02\x84_\x00;".freeze | |
send_data tracking_gif | |
end | |
end |
This file contains 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/bin/env ruby | |
require 'rubygems' | |
require 'resque' | |
HOST = ENV['host'] ? ENV['host'] : '127.0.0.1' | |
PORT = ENV['port'] ? ENV['port'] : '6379' | |
Resque.redis = "#{HOST}:#{PORT}" |
This file contains 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/bin/env ruby | |
require 'rubygems' | |
require 'resque' | |
HOST = ENV['host'] ? ENV['host'] : '127.0.0.1' | |
PORT = ENV['port'] ? ENV['port'] : '6379' | |
Resque.redis = "#{HOST}:#{PORT}" |
This file contains 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
scope :case_insensitive_email, lambda { |email| where("email ILIKE ?", email) } | |
request parameters: {"email"=>"foo\\"} | |
PGError: ERROR: LIKE pattern must not end with escape character | |
: SELECT "users".* FROM "users" WHERE (email ILIKE 'foo\') LIMIT 1 | |
This file contains 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 compare_to(version) | |
reject_fields = ["_id", "updated_at", "version"] | |
diff_array = self.versions[version-1].attributes.to_hash.to_a - self.attributes.to_hash.to_a | |
diff_array.delete_if {|f| reject_fields.include?(f.first) } | |
Hash[diff_array] | |
end |
This file contains 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
var file = fs.createReadStream(path); | |
var sha1_for_file = crypto.createHash('sha1'); | |
file.addListener('error', function(err) { | |
throw err; | |
}); | |
file.addListener('data', function(data) { | |
sha1_for_file.update(data); | |
}); | |
file.addListener('close', function() { |