Skip to content

Instantly share code, notes, and snippets.

View codatory's full-sized avatar

Alex Conner codatory

View GitHub Profile
@codatory
codatory / deprecation_logger.rb
Created April 4, 2011 21:07
Rails Deprecation Logger
# Stick this in config/initializers and restart your app to install
# Then you can log your deprecations to log/deprecations.log quickly and easily
# To log with this, just call:
# DeprecationLogger.notify('StringDescriptionOfMethod', DeprecationLogger.caller_method)
class DeprecationLogger < Logger
@logfile = File.open(Rails.root.join('log','deprecations.log'), 'a')
@logfile.sync = true
@codatory
codatory / gist:892502
Created March 29, 2011 15:04
git-goodness
# This is in my .profile, you could also put it in your .bash_profile
feature_deliver() {
CURRENT=`git branch | grep '\*' | awk '{print $2}'`
feature_update
git checkout master
git merge --squash --no-commit ${CURRENT}
git commit
}
feature_update() {
@codatory
codatory / bashrc
Created March 7, 2011 17:37
Ubuntu Ruby Development Bootstrapper Script
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
if [[ -n "$PS1" ]]; then
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
@codatory
codatory / pitoval_import.rake
Created February 5, 2011 19:35
Pivotal Tracker Importer for Redmine
begin
require 'ruport'
rescue LoadError => err
warn "Couldn't load ruport gem: #{err}"
end
namespace :import do
desc 'Import tickets from CSV File'
task :csv => :environment do
@codatory
codatory / WeightWatchersCalculatorFn.php
Created April 10, 2009 16:10
PHP Function for calculating weight watcher's point values.
<?php
function calculate ($calories, $fiber, $fat) {
$points_from_fat = $fat / 12;
if ($fiber = 0) {
$fiber_caloric_reduction = 0;
} elseif ($fiber < 4) {
$fiber_caloric_reduction = $fiber * 10;
} elseif ($fiber > 4) {
$fiber_caloric_reduction = 40;