Skip to content

Instantly share code, notes, and snippets.

View wuputah's full-sized avatar
🐘

Jonathan Dance (JD) wuputah

🐘
View GitHub Profile
#!/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
1_000_000.times do |i|
String.new
if i % 1000 == 0
puts ObjectSpace.each_object { }
end
end
@wuputah
wuputah / gist:66777
Created February 19, 2009 07:42 — forked from anonymous/gist:66776
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")
@wuputah
wuputah / gist:249619
Created December 5, 2009 08:35 — forked from radar/gist:249555
#!/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
class Hash
def map_values(&block)
inject(Hash.new) do |hsh, (k, v)|
hsh[k] = yield(v)
hsh
end
end
end
~/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
# 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"
@wuputah
wuputah / gist:605328
Created September 30, 2010 21:06 — forked from Znow/gist:605316
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