Skip to content

Instantly share code, notes, and snippets.

View troyericg's full-sized avatar

Troy Griggs troyericg

  • The New York Times
  • New York
View GitHub Profile
@troyericg
troyericg / README.md
Last active July 6, 2016 16:10
css gif with sprite

A fork/copy of Ben Welsh's code, which is a demonstration of how to create a GIF-like animation using only CSS. The only modification I've made is to use a sprite instead of multiple images.

@troyericg
troyericg / getpublic.rb
Last active April 4, 2016 18:56
ruby script for downloading public/published google spreadsheets as csvs
require 'rubygems'
require 'fileutils'
require 'nokogiri'
require 'open-uri'
require 'csv'
###############
# GET PUBLIC: # A script for downloading/parsing public google spreadsheets
###############
@troyericg
troyericg / modernizr.custom.js
Created May 1, 2015 09:57
My custom build of Modernizr
/* Modernizr 2.8.3 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-fontface-backgroundsize-borderradius-boxshadow-flexbox-flexboxlegacy-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-hashchange-history-audio-video-input-localstorage-sessionstorage-websockets-inlinesvg-svg-svgclippaths-touch-webgl-shiv-cssclasses-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load
*/
;window.Modernizr=function(a,b,c){function C(a){j.cssText=a}function D(a,b){return C(n.join(a+";")+(b||""))}function E(a,b){return typeof a===b}function F(a,b){return!!~(""+a).indexOf(b)}function G(a,b){for(var d in a){var e=a[d];if(!F(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function H(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:E(f,"function")?f.bind(d||b):f}return!1}function I(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+p.join(d+" ")+d).split(" ");return E
@troyericg
troyericg / smartresize.js
Created May 1, 2015 09:51
An extracted version of the debounced resize function from John Hann, via Paul Irish
// debouncing function from John Hann, via Paul Irish
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
;(function(sr){
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
if (!execAsap)
func.apply(obj, args);
@troyericg
troyericg / retrieving querystring values
Created March 20, 2015 15:51
two ways to grab querystrings using pure js
function splitURL(){
var query = window.location.search.substring(1),
vars = query.split("&"),
params = {},
p;
for (var i=0; i<vars.length;i++){
p = vars[i].split("=");
params[ p[0] ] = p[1];
};
@troyericg
troyericg / Refresh Facebook Cache
Last active August 29, 2015 14:17
How to update Facebook's page cache
Go to this page...
https://developers.facebook.com/tools/debug/
... and add this string ...
?fbrefresh=CAN_BE_ANYTHING
... to any url ...
<URL />
... and get ...
@troyericg
troyericg / installation guide
Last active December 5, 2016 18:36
Every time I get a new computer I have to remember everything I've ever had to install, and I'm sick of it. (*work in progress*)
A PERONSAL INSTALLATION GUIDE:
--------------------
SETUP:
- Github Account
- AWS
@troyericg
troyericg / git-merge-strategies
Created October 16, 2014 16:08
(Because I always forget) How to overwrite a master branch with a remote branch
git checkout better_branch
git merge --strategy=ours master # keep the content of this branch, but record a merge
git checkout master
git merge better_branch # fast-forward master up to the merge
----------------------
If you want your history to be a little clearer, I'd recommend adding some information to the merge commit message to make it clear what you've done. Change the second line to:
@troyericg
troyericg / link-blocker
Created April 30, 2014 17:09
deactivates links on a page (typically for html mockups)
@troyericg
troyericg / bash_scripts
Last active December 14, 2015 03:59
a few modifications to my shell.
# ------------------------------------------------
# Opens up various text editors in background
alias subl='open -a "Sublime Text 2" -g'
alias mate='open -a "TextMate" -g'
# ------------------------------------------------
# Server Aliases