Skip to content

Instantly share code, notes, and snippets.

View jlee42's full-sized avatar

Jeffrey Lee jlee42

View GitHub Profile
#
# Paperclip convert id => id_partition
#
require 'ftools' #FileUtils
class PaperclipExtend
def self.obtain_class
class_name = ENV['CLASS'] || ENV['class']
uploads_path = ENV['UPLOADS_PATH'] || ENV['uploads_path']
raise "Must specify CLASS" unless class_name
@jlee42
jlee42 / txt2rtf.sh
Created July 6, 2012 18:59 — forked from gildotdev/txt2rtf.sh
Simple Bash script to create a rich text format file from a plain text file
#!/bin/sh
#check to see if arguments are set
E_BADARGS=65
if [ ! -n "$1" ]
then
echo "Usage: `basename $0` textfilename [rtffilename optional]"
exit $E_BADARGS
fi
@jlee42
jlee42 / gist:3062087
Created July 6, 2012 19:00 — forked from peterwongpp/gist:2994714
My Shell Command Line Format - colored, with Git support and shortened
# return the current git branch name
parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ →\ \1/'
}
# return the string of state of the branch
parse_git_dirty() {
D="$(git status 2> /dev/null | tail -n1 | awk '{ print $1 }' )"
if [ "$D" = "nothing" ] ; then
echo -e "(clean) "