Skip to content

Instantly share code, notes, and snippets.

View netzpirat's full-sized avatar

Michael Kessler netzpirat

View GitHub Profile
@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 / 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 / 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 / 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 / resize.rb
Created March 18, 2010 20:46
A simple ruby rmagick resize script
#!/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 pixesl and
# a max height of 533 pixels. The resized image will be written to a new file with the extension 'preview.jpg'
#
@netzpirat
netzpirat / mass_mailer.rb
Created March 18, 2010 23:56
Send email to all email addresses from a MySQL table
#!/usr/bin/env ruby
#
# Send mass emails to the users of my small private email server
# with TLS.
#
# Queries the MySQL database for my vhost users and sends an
# email with ActionMailer to them.
#
# Install dependencies with `gem install mysql actionmailer`
#
@netzpirat
netzpirat / rubymine.rb
Created April 14, 2010 19:32
Minimal Rails 3 support for RubyMine: Creates the old Rails 2 scripts that simply executes Rails 3 'rails' command.
#!/usr/bin/env ruby
#
# Helper script to temporary fix some RubyMine 2.0.2 functionality by
# creating old-style Rails 2 scripts. This enables me actually to
# run & debug apps and use the Rails console.
#
# On my machine I have to increase the debugger timeout to connect to a
# Rails 3 app on Ruby 1.9.1. This is done for OS X by modify the Info.plist
# to increase the timeout.
#
@netzpirat
netzpirat / gist:385727
Created April 30, 2010 20:45
Install ruby-debug on 1.9.2 head
gem install ruby-debug19 -- --with-ruby-include=~/.rvm/src/ruby-1.9.2-head/
@netzpirat
netzpirat / gist:430778
Created June 8, 2010 23:10
Ruby debug with RVM and Ruby 1.9
gem install ruby-debug19 -- --with-ruby-include=/home/michi/.rvm/src/ruby-1.9.2-preview3
@netzpirat
netzpirat / jspec.rake
Created September 9, 2010 14:16
Generate jspec run configurations (dom.html, rhino.js and server.html) out of a central configuration file with file globbing!
#
# Rake task for generating the different jspec run configuration from
# a single, central configuration file that supports file globbing
#
# Author: Michael Kessler aka. netzpirat
# License: MIT
#
namespace :jspec do
desc 'Generate the run configurations for all environments'