Skip to content

Instantly share code, notes, and snippets.

View jmazzi's full-sized avatar

Justin Mazzi jmazzi

View GitHub Profile
@jmazzi
jmazzi / .bashrc
Created January 30, 2009 14:02 — 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)]/"
@jmazzi
jmazzi / .bashrc
Created February 1, 2009 00:40 — 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)]/"
@jmazzi
jmazzi / codes.rb
Created February 4, 2009 16:45 — forked from jamis/codes.rb
# Generates a series of substitution cipher puzzles. The messages to
# "encrypt" are take from a text file passed on the command-line,
# where each message is on one line.
#
# The output is a PDF, "codes.pdf".
#
# This was written for my 7 year-old, who loves doing substitution
# ciphers.
require 'prawn'
# Original, did not work in production
map.connect 'referrals/logout', :controller => 'referrals/login', :action => 'logout'
map.connect 'referrals/:action/:id', :controller => 'referrals/home'
@valid_messages = [
'Viatalk helps me connect with my friends and family!',
'I love Viatalk Phone Service!',
'Viatalk Phone Service is the only VoIP for me!',
'Viatalk is the best VoIP Provider in the world!',
'Viatalk is my favorite VoIP provider!'
]
# --------------------------------------------------------
#
# rails template for skeleton app, haml, sass, shoulda, factory_girl, jquery
#
# TO-DO: Change the location of edge rails or equiv to match env.
#
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/code/rails-edge rails' }
# Delete unnecessary files
run "rm README"
class Foo < ActiveRecord::Base
# attrs: bar (integer), baz (integer)
# want to make sure Foo.baz is > than Foo.bar
# this would only run validation when baz is numeric (because any int is > nil)
validates_each :bar do |record, attr, value|
if record.baz.is_a?(Numeric)
if value.is_a?(Numeric)
record.errors.add attr, 'must be less than baz.' unless value < record.baz
end
sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-include=/opt/local/include/mysql5 --with-mysql-lib=/opt/local/lib/mysql5 --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config
while(true); do curl -s -L http://phobos.apple.com/version | grep -i restore | grep '_3.' | perl -p -e 's/<string>http:\/\/.*\/(.*)<\/string>/$1/g' | perl -p -e 's/\s+/\n/g' | grep -v iPhone2,1_3.0_7A341_Restore; sleep 10; done
The form/controller works fine in development, and doesn't in production. It DID work fine in production earlier this week, but now it doesn't, and I didn't make any changes to the code. Any ideas, please send to garyz@easysoftsolutions.com.
Controller
class JobseekerprofilesController < ApplicationController
include ActsAsTinyURL
before_filter :login_required, :except => [:show]
caches_page :show