Skip to content

Instantly share code, notes, and snippets.

Corey Ward coreyward

Block or report user

Report or block coreyward

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
coreyward / date_formatting.rb
Created Jul 21, 2017
Copy-pasteable Rails initializer that will handle date to string conversion and parsing (with output as MM/DD/YYYY by default)
View date_formatting.rb
Date::DATE_FORMATS[:default] = "%m/%d/%Y"
module FixDateFormatting
class EasyDate < ActiveRecord::Type::Date
def cast_value(value)
default = super
parsed = Chronic.parse(value)&.to_date if value.is_a?(String)
parsed || default
coreyward / theme.css
Created Apr 6, 2017
Acton Wufoo Theme
View theme.css
body {
font-family: "Open Sans", Helvetica, Arial;
background: #1A293E;
color: #fff;
#header {
display: none;

Keybase proof

I hereby claim:

  • I am coreyward on github.
  • I am coreyward ( on keybase.
  • I have a public key whose fingerprint is 588A B309 8DE7 3379 60A5 6BE5 8095 E17F 15D4 EE89

To claim this, I am signing this object:

coreyward / gist:60b7eb23373f40f9ebcb
Created Jun 30, 2014
Track outbound link clicks in Google Analytics (Universal / analytics.js) with fallback
View gist:60b7eb23373f40f9ebcb
# only bind if/when GA loads
ga ->
$('a[href*="//"]').click (e) ->
url = $(this).attr('href')
# define the callback
action = -> document.location = url
# record the click as an event
coreyward / gist:e34898d09968f5aa4aa6
Created Jun 30, 2014
Non-blocking iFrame loads, because Vimeo embeds are slow to load, and iFrames block onLoad firing (and thus negatively impact pageload measurements).
View gist:e34898d09968f5aa4aa6
# Non-Blocking iFrames
$ ->
$('iframe[data-src]').each ->
this.setAttribute 'src', this.getAttribute 'data-src'
coreyward / baseline_tattler.js
Last active Aug 29, 2015
Quick and dirty way to find DOM elements that are breaking your vertical baseline grid.
View baseline_tattler.js
var h, el, baseline;
el = $(this);
height = el.outerHeight();
baseline = 13;
if (Math.round(height) % baseline > 0) {
console.log( height, this );
coreyward / The Back
Last active Dec 27, 2015
The standard bar stock at PDT in NYC, per *The PDT Cocktail Book*.
View The Back

PDT Stocked Liquors


  • Absolut 100
  • Belvedere
  • Heart of the Hudson
  • Karlsson's
  • Smirnoff Black
coreyward / add_skills_users_join_table.rb
Created Oct 25, 2013
Rather than using a Postgres string array and doing selection in Ruby, utilize ActiveRecord and SQL to only retrieve the relevant data in the first place. Feedback on
View add_skills_users_join_table.rb
# db/migration/2013_add_skills_users_join_table.rb
class AddSkillsUsersJoinTable < ActiveRecord::Migration
# see
def change
create_table :skills_users do |t|
t.belongs_to :skill
t.belongs_to :user
coreyward / gist:4127081
Created Nov 21, 2012
I wanted to get an early bird reward for a Kickstarter project, and sometimes people abandon them to switch tiers or un-pledge, so I slapped some code together using Typhoeus, Nokogiri, and Twilio to retrieve the Kickstarter page, grab the relevant reward
View gist:4127081
# coding: utf-8
require 'rubygems'
require 'twilio-ruby'
require 'nokogiri'
require 'typhoeus'
# Setup Request
url = ""
selector = "#what-you-get li:nth-child(4)"
coreyward / gist:3960133
Created Oct 26, 2012
Seg fault when running ruby-prof on Enki using Rails 3.2.8
View gist:3960133
$ ruby-prof `which rake` environment
/Users/corey/.rvm/gems/ruby-1.9.3-p194/gems/ruby-prof-0.11.2/bin/ruby-prof:258: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]
-- Control frame information -----------------------------------------------
c:0003 p:0029 s:0010 b:0009 l:0008c8 d:000008 BLOCK /Users/corey/.rvm/gems/ruby-1.9.3-p194/gems/ruby-prof-0.11.2/bin/ruby-prof:258
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001a48 d:001a48 TOP
-- Ruby level backtrace information ----------------------------------------
You can’t perform that action at this time.