Skip to content

Instantly share code, notes, and snippets.

JD wuputah

Block or report user

Report or block wuputah

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:605328
source 'http://rubygems.org'
gem 'rails', '3.0.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development do
gem 'sqlite3-ruby', :require => 'sqlite3'
end
View eydeploy.rb
# in ey-deploy 1.1.0, we just need to add without clauses
def get_bundler_installer(*)
installer = super
installer.options << " --without cucumber test development"
installer
end
# - alternative method - override bundle and exec the install ourselves.
# def bundle
# info "~> Bundling gems"
View gist:485167
~/p/wegowise (master) % sc
Loading development environment (Rails 2.3.5)
ree-1.8.7-2010.02 > require 'active_support'
=> []
ree-1.8.7-2010.02 > fucker = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(nil, 'HAHAHA')
=> nil
ree-1.8.7-2010.02 > !! fucker
=> true
ree-1.8.7-2010.02 > fucker.nil?
=> true
View gist:465884
class Hash
def map_values(&block)
inject(Hash.new) do |hsh, (k, v)|
hsh[k] = yield(v)
hsh
end
end
end
View gist:249619
#!/bin/bash
# You can run this on your server by doing this:
# bash -c "`wget -O - frozenplague.net/boris`"
# If you don't have wget, use curl.
echo "Need your password to install things:"
sudo apt-get -y update
sudo apt-get -y install build-essential mysql-server libmysqlclient15-dev apache2 libssl-dev apache2-prefork-dev libapr1-dev libaprutil1-dev zlib1g zlib1g-dev
pushd /tmp
View gist:66777
The query:
select episodes.id from episodes
left outer join links on links.link_id = episodes.link_id
where episodes.link_id > 0 and links.link_id is NULL
The Rails:
Episode.find(:all, :include => :link, :conditions => "episodes.link_id > 0 and links.link_id is NULL")
View gist:64454
1_000_000.times do |i|
String.new
if i % 1000 == 0
puts ObjectSpace.each_object { }
end
end
View gist:15387
#!/usr/bin/env ruby
`find /var/www/vhosts/santosdumont.com/web_users/ -type f`.split("\n").each do |file|
basename = File.basename(file)
system("mv", file, "/var/www/vhosts/santosdumont.com/httpdocs/Resource/" + basename)
end
You can’t perform that action at this time.