Skip to content

Instantly share code, notes, and snippets.

View netzpirat's full-sized avatar

Michael Kessler netzpirat

View GitHub Profile
@netzpirat
netzpirat / twitter.rb
Created March 11, 2010 19:05
Tweet a message on successful multistage capistrano deployment
require 'open-uri'
require 'net/http'
namespace :tweet do
desc 'Posts deployment information to twitter'
task :notify do
begin
File.open(File.expand_path('~/.twitter')) do |file|
@netzpirat
netzpirat / kickstart.rb
Created January 28, 2010 14:20
Make an initial HTTP request to start Phusion Passenger after deployment
namespace :deploy do
desc "Send initial HTTP request to start Phusion Passenger application spawner"
task :kickstart, :roles => :web do
servers = find_servers_for_task(current_task)
servers.each do |server|
run_locally "wget http://#{server.host} -O - > /dev/null"
end
end
@netzpirat
netzpirat / sendQuotaMail.sh
Created January 17, 2010 18:04
Check vmail quota and send user notification
#!/bin/bash
VMAIL_HOME=/usr/local/vmail
cd $VMAIL_HOME
for d in `ls -d *.ch`
do
for u in `ls $d`
do
cd $VMAIL_HOME/$d/$u
@netzpirat
netzpirat / _README.md
Created November 19, 2009 21:45 — forked from kneath/_README.md

GitHub Javascript Strategy

Unless otherwise necessary (such as mobile development), the GitHub javascript codebase is based off jQuery. You can safely assume it will be included on every page.

File naming

  • All jquery plugins should be prefixed with jquery, such as jquery.facebox
  • All github-specific jquery plugins should be prefixed with jquery.github. Like jquery.github.repo_list.js
  • All page-specific files (that only run on ONE page) should be prefixed with page. page.billing.js
@netzpirat
netzpirat / snow_leopard.yml
Created November 18, 2009 19:47
Using gem bundler on snow leopard
mysql:
mysql-config: /opt/local/lib/mysql5/bin/mysql_config
@netzpirat
netzpirat / gist:238162
Created November 18, 2009 19:29
Running webrat and celerity parallel
We couldn’t find that file to show.
@netzpirat
netzpirat / env.rb
Created November 18, 2009 19:22
Cucumber ActiveResource faking
require 'fakeweb'
require 'fake_resource'
ActiveResource::Base.send :include, ActiveResource::FakeResource
Before do
FakeWeb.allow_net_connect = false
end
After do |scenario|
ActiveResource::FakeResource.clean
@netzpirat
netzpirat / Info.plist
Created November 16, 2009 16:07
RubyMine GC Performance Tuning
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>rubymine</string>
<key>CFBundleIconFile</key>
<string>rubymine.icns</string>
@netzpirat
netzpirat / resize.rb
Created October 23, 2009 22:21
A simple ruby script generate image previews
#!/usr/bin/env ruby
# A simple ruby rmagick resize script.
#
# Example: ./resize.rb /user/joe/mypics 400 533
#
# Searches /user/joe/mypics recursively for all files ending with 'jpg'; the search is case
# insensitive. The found image will be proprtinaly scaled to a max width of 400 pixels and
# a max height of 533 pixels. The resized image will be written to a new file with the
# extension 'preview.jpg'
@netzpirat
netzpirat / Install mysql gem on os x with macports installed mysql
Created September 11, 2009 22:17
Compile MySql RubyGem on Snow Leopard
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config