Skip to content

Instantly share code, notes, and snippets.

View ardell's full-sized avatar

Jason Ardell ardell

  • Agile Engineering LLC
  • Silverthorne, CO
View GitHub Profile

Keybase proof

I hereby claim:

  • I am ardell on github.
  • I am ardell (https://keybase.io/ardell) on keybase.
  • I have a public key ASD5TUIHqsnAm_6YxheI4M17J3LOdDdsvai_yqA58Qc5zAo

To claim this, I am signing this object:

defmodule GeocodingAdapter.GoogleMaps do
defmodule UnparseableResponse do
defexception message: "Received a response from Google Maps that contained invalid json"
end
def geocode(address) do
fetch_response
|> return_empty_unless_success
|> parse_body
@ardell
ardell / gist:8256a67c918152d8a697
Created August 21, 2014 23:39
Add asterisks at 45 and 75 characters (for container sizing)
(function(){var script=document.createElement('script');script.src = "//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js";document.getElementsByTagName('head')[0].appendChild(script);jQuery.noConflict();jQuery('p').html(function(){var t=jQuery(this).text();return t.substring(0,45)+"*"+t.substring(45,75)+"*"+t.substring(75);})})()
@ardell
ardell / gist:1926928
Created February 27, 2012 20:49
Font Profiler
// Do this to find out the font style usage on a given page
var styles = { 300: { 'normal': 0, 'italic': 0}, 400: { 'normal': 0, 'italic': 0}, 500: { 'normal': 0, 'italic': 0}, 700: { 'normal': 0, 'italic': 0} };
jQuery('body *').each(function(i, e) { var $e = jQuery(e); var weight = $e.css('font-weight'); if (weight == 'normal') weight = 400; if (weight == 'bold') weight = 700; var style = $e.css('font-style'); styles[weight][style] += 1; });
@ardell
ardell / gist:1641010
Created January 19, 2012 16:29
Chef secure_package resource
define :secure_package, :name => nil do
ruby_block "Check dependencies" do
raise "Variable name cannot be nil" if params[:name] == nil
end
execute "sudo yum -d0 -e0 -y install #{params[:name]}"
end
#!/bin/sh
#
# Use ipfw to throttle bandwidth.
# usage:
# ./throttle.sh # Throttle at default (60KB/s)
# ./throttle.sh 5 # Throttle at custom speed (5KB/s)
# ./throttle.sh off # Turn throttling off
# flush rules
ipfw del pipe 1
@ardell
ardell / gist:645851
Created October 25, 2010 21:50
Chef run for gt-tutorial
apache2
apache2::mod_ssl
php
php::module_mysql
apache2::mod_php5
git
openssl
mysql::server
cakephp
gt-tutorial (does: a2dissite, git init, add .gitignore, git commit)
# I put these in my ~/.zshrc, you can put them in your .git/config if you prefer (but in a different format)
git config --global merge.tool opendiff
git config --global merge.opendiff.cmd ~/git-diff-cmd.sh
git config --global mergetool.prompt false
--- My ~/git-diff-cmd.sh (make sure you "chmod +x" it!) ---
#!/bin/sh
/usr/bin/opendiff "$2" "$5" -merge "$1"
--- How to use it ---