Skip to content

Instantly share code, notes, and snippets.

View adamrunner's full-sized avatar

Adam Runner adamrunner

View GitHub Profile
# could probably restore
26245b4929cb75c830649ba7863ce5697b4d5235 lib/assets/javascripts/admin/models/item.js.coffee
92fcd0628ce52ab5a89f01c1b63e1bb2b844b489 lib/assets/javascripts/admin/models/item/field.js.coffee
92fcd0628ce52ab5a89f01c1b63e1bb2b844b489 lib/assets/javascripts/admin/models/item/stub.js.coffee
# has been restored
lib/assets/javascripts/admin/models/product.js.coffee
lib/assets/javascripts/admin/models/product_collection.js.coffee
# shouldn't need restored - but if we're being paranoid
@adamrunner
adamrunner / new_mac_setup.md
Last active May 6, 2025 06:03 — forked from saetia/gist:1623487
Some steps to take when setting up a new mac

OS X Preferences


#Disable window animations
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false

# Remove the auto-hiding Dock delay
defaults write com.apple.dock autohide-delay -float 0;
@adamrunner
adamrunner / resque-scheduler
Last active January 3, 2017 03:42
resque-scheduler
#! /bin/sh
### BEGIN INIT INFO
# Provides: resque_scheduler
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts Scheduler for Resque
# Description: This script will start the resque scheduler task so
# jobs will be automatically scheduled.
@adamrunner
adamrunner / 04.python
Last active August 29, 2015 13:57
Problems installing libxml2 with homebrew OS X 10.9.2
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:251: UserWarning: 'licence' distribution option is deprecated; use 'license'
warnings.warn(msg)
libxslt stub generator not found, libxslt not built
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-intel-2.7
copying libxml2.py -> build/lib.macosx-10.9-intel-2.7
copying drv_libxml2.py -> build/lib.macosx-10.9-intel-2.7
# Script used to quickly get a glance of how many queries since a certain time period were longer than X seconds
# Customize these 2 parameters
STARTDATE="140303" # 2 Digit Year, 2 Digit Month, 2 Digit Day
QUERYTIME=3.0
# Runs the commands and prints out Query_time lines
FIRST=`grep -n -m 1 "# Time: $STARTDATE" slow.log | cut -d : -f 1`; TOTAL=`wc -l slow.log | cut -d ' ' -f 1`; tail -n `echo "$TOTAL-$FIRST" | bc` slow.log | grep Query_time | awk -v time="$QUERYTIME" '$3 > time {print; }'
@adamrunner
adamrunner / git_clean_remote
Created January 17, 2013 21:58
clear all old remote branches
git remote prune origin
git branch -r --merged | grep origin | grep -v '>' | grep -v master | grep -v dev | xargs -L1 | awk '{sub(/origin\//,"");print}' | xargs git push origin --delete
@adamrunner
adamrunner / resque.rake
Created January 15, 2013 22:58
working resque.rake file for newrelic_rpm
# load the Rails app all the time
require "resque/tasks"
require "resque_scheduler/tasks"
require "newrelic_rpm"
ENV["NEWRELIC_ENABLE"] = "true"
task "resque:setup" => :environment do
Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection; NewRelic::Agent.manual_start :license_key=>"04bba1b0698194f36a96c319818b19818b614af00a955e", :app_name => "Background Workers" }
end
@adamrunner
adamrunner / display_time.rb
Created August 16, 2012 21:20
Calculate Difference in time in Days, Hours, Minutes, Seconds
def display_time(total_seconds)
total_seconds = total_seconds.to_i
days = total_seconds / 86400
hours = (total_seconds / 3600) - (days * 24)
minutes = (total_seconds / 60) - (hours * 60) - (days * 1440)
seconds = total_seconds % 60
display = ''
display_concat = ''