Skip to content

Instantly share code, notes, and snippets.

View drydevelopment's full-sized avatar

Doug Yoder drydevelopment

View GitHub Profile
module LogModelUpdates
def self.included(base)
base.send :include, InstanceMethods
end
module InstanceMethods
attr_accessor :current_user
attr_accessor :row_updates
def before_save
@drydevelopment
drydevelopment / gitconfig
Created January 21, 2011 20:28
.gitconfig
[user]
name = [First and Last Name]
email = [Email]
[apply]
whitespace = nowarn
[diff]
color = auto
[status]
color = auto
[push]
@drydevelopment
drydevelopment / Spork No server is running
Created March 14, 2011 19:02
Spork No server is running
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
No server is running
Running specs locally:
Spork is ready and listening on 8989!
install_everything(){
install_homebrew
install_git
install_imagemagick
install_memcached
install_sphinx
install_rvm
# install_mysql # Install from http://dev.mysql.com/downloads/mysql/5.1.html
# install_passenger
install_big_red
module Within3
module Setup
module RVM
def self.install
puts "Installing RVM..."
exec "curl -s https://rvm.beginrescueend.com/install/rvm | bash"
puts "RVM installed!"
end
end
end
@drydevelopment
drydevelopment / jasmine-console.js
Created November 15, 2012 15:53
Jasmine Console Runner
jasmine.ConsoleReporter = function(showColors)
{
if (!showColors)
showColors = true
var ansi = {
green: '\033[32m',
red: '\033[31m',
yellow: '\033[33m',
/**
* Override window.setInterval to auto-call the function argument
* and bypass the delay to keep tests snappy.
*/
window.setInterval = function(func, delay) {
func.call();
};
@drydevelopment
drydevelopment / deploy.rb
Created February 6, 2015 21:49
CPU Crushing Fix: resque + resque-scheduler + capistrano-resque + newrelic
# The resque-scheduler process would not respond to `kill -s QUIT [pid]`, and
# after a long time diagnosing the problem I found that the source of the problem
# was Newrelic. YAY! Disabling newrelic
task :disable_newrelic do
set :bundle_cmd, "NEWRELIC_ENABLE=false #{bundle_cmd}"
end
before "resque:start", "disable_newrelic"
before "resque:scheduler:start", "disable_newrelic"

Keybase proof

I hereby claim:

  • I am drydevelopment on github.
  • I am dyoder (https://keybase.io/dyoder) on keybase.
  • I have a public key whose fingerprint is 5E4A F507 C554 9FEF 68C4 0224 62D3 5EC7 847F E4C3

To claim this, I am signing this object:

@drydevelopment
drydevelopment / iso_8601_timestamp.sql
Last active February 15, 2018 20:12
PostgreSQL function to output an ISO 8601 formatted timestamp with time zone
/* Tested on PostgreSQL 9.6 */
CREATE OR REPLACE FUNCTION iso_8601_timestamp(datetime TIMESTAMP WITH TIME ZONE)
RETURNS VARCHAR AS $$
BEGIN
RETURN to_char(datetime::TIMESTAMPTZ AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS"Z"');
END;
$$
LANGUAGE PLPGSQL;