Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
THE_DATE="$(date '+%Y-%m-%d')"
BACKUP_DIR="/Users/`whoami`/Desktop/db-backups/"
MYSQL_HOST="localhost"
MYSQL_USER="root"
MYSQL_PASS=""
MYSQL_BACKUP_DIR="$BACKUP_DIR"
MYSQL_PATH="$(which mysql)"
@kevinold
kevinold / .bashrc
Created May 22, 2009 00:17 — forked from henrik/.bashrc
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
@kevinold
kevinold / base58.rb
Created June 24, 2009 17:01 — forked from jou/base58.rb
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Copyright (C) 2004 Sam Hocevar
# 14 rue de Plaisance, 75014 Paris, France
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
##
# Calendar helper with proper events
# http://www.cuppadev.co.uk/webdev/making-a-real-calendar-in-rails/
#
# (C) 2009 James S Urquhart (jamesu at gmail dot com)
# Derived from calendar_helper
# (C) Jeremy Voorhis, Geoffrey Grosenbach, Jarkko Laine, Tom Armitage, Bryan Larsen
# Licensed under MIT. http://www.opensource.org/licenses/mit-license.php
##
@kevinold
kevinold / gist:191368
Created September 22, 2009 20:04 — forked from peterc/gist:33337
Fully featured Rails template (for Rails 2.3)
# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
@kevinold
kevinold / VPS Setup Shell Script
Created October 22, 2009 16:48 — forked from traviskroberts/gist:151026
CentOS 5.3 VPS Setup Shell Script
#!/bin/bash
# You must run as root!!! (or sudo)
#####################
##### IMPORTANT #####
#####################
# Add the following entry to /etc/yum.repos.d/rubyworks.repo:
#
# [rubyworks]
@kevinold
kevinold / prawn_term_sheet.rb
Created October 22, 2009 19:25 — forked from mileszs/prawn_term_sheet.rb
Testing Prawn PDF generation
#!/usr/bin/ruby -w
#
# Testing Prawn PDF generation
require 'rubygems'
require 'prawn'
require 'prawn/layout'
require 'prawn/format'
class TermSheet < Prawn::Document
@kevinold
kevinold / sinatra-forms.rb
Created November 2, 2009 15:47 — forked from rtomayko/sinatra-forms.rb
Sinatra forms
# Subject: Re: Newbie to Sinatra looking for example
# From: Ryan Tomayko <r@tomayko.com>
# To: sinatrarb@googlegroups.com
# Content-Type: text/plain; charset=UTF-8
#
# > Alright, so I'm pretty new to both Sinatra and web applications, and I
# > was wondering if someone could write up a quick example use of
# > Sinatra. Basically I want to see how Sinatra handles <form>s in one
# > view, and then shows the input on a different view.
# >
@kevinold
kevinold / gist:239656
Created November 20, 2009 17:45 — forked from mislav/gist:17371
haml2erb
class ErbEngine < Haml::Engine
def push_script(text, preserve_script, in_tag = false, preserve_tag = false,
escape_html = false, nuke_inner_whitespace = false)
push_text "<%= #{text.strip} %>"
end
def push_silent(text, can_suppress = false)
push_text "<% #{text.strip} %>"
end
end
@kevinold
kevinold / gist:253518
Created December 10, 2009 17:54 — forked from jshirley/gist:253512
plackup init script
#!/bin/sh
# Start a Plack daemon.
PATH=/bin:/usr/bin:/sbin:/usr/sbin:$HOME/perl5/bin
DAEMON="$HOME/perl5/bin/plackup"
NAME="AppName"
CWD=`pwd`
# Defaults
RUN="no"