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 / google spreadsheet url scraper
Created January 31, 2013 18:52
For copying an HTML table from a website into a google spreadsheet
=ImportHtml("url","query","index")
url = url of page to download
query = "table" (type of html object)
index = "3" a number (to skip over other things on the page that might
be set up as a table)
@troyericg
troyericg / code drop
Last active July 23, 2018 22:39
where I keep miscellaneous code snippets
<!-- to force a mobile view on a responsive site. Place in-between the header tags. -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;">
/* To correctly size elements with borders and padding */
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
@troyericg
troyericg / Command Line Commands
Created January 31, 2013 19:47
A quick list of OSX Terminal commands. For an A-Z index of the Apple OS X command line, I go to http://ss64.com/osx/
" cd " - Current Directory
" cd - " - Takes you to the last directory you were in
" . " Current Directory
".." Previous Directory
"~" Home Directory (But don't do it!)
@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
@troyericg
troyericg / link-blocker
Created April 30, 2014 17:09
deactivates links on a page (typically for html mockups)
@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 / 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 / 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 / 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 / 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);