Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am here on github.
  • I am here (https://keybase.io/here) on keybase.
  • I have a public key whose fingerprint is CF39 8F78 6AB6 508F B3AF D303 8FD2 C2F3 2ABC 208F

To claim this, I am signing this object:

@here
here / gist:4f3af6dafdb4ca15e804
Last active August 29, 2015 14:04
How to resolve git stash pop merge conflict with unstaged changes
# trying to replicate and solve this situation:
# http://stackoverflow.com/questions/8515729/aborting-a-stash-pop-in-git/
# tl;dr, if you didn't have any staged changes, this should work:
git diff --name-only --cached|xargs git checkout --ours HEAD
git ls-tree stash@{0}^3 --name-only|xargs rm
# If there were no untracked files introduced from the stash
# then the second command will fail with
@here
here / 20140915-madlib-words
Created September 16, 2014 01:58
madlib words 20140915
1noun
2verb
3noun
4verb
5pronoun
6adj
7adj
8noun
9noun
10verb
@here
here / madlib.txt
Created September 16, 2014 02:39
madlib
The sketch:
A [1noun] enters a pet shop.
Mr. Praline: 'Ello, I wish to [2verb] a [3noun].
(The owner does not [4verb].)
Mr. Praline: 'Ello, [5pronoun]?
@here
here / gist:8c908f00fd3f45e76805
Created November 4, 2014 06:05
wordpress arbitrary js from php using wp_localize_script
Working in 4.0
functions.php:
// localize_script js object hack.
wp_register_script('gimme-objects', get_stylesheet_directory_uri() . '/gimme-objects.js' );
wp_localize_script('gimme-objects', 'foo', array( 'l10n_print_after' => 'foo = {}' ));
@here
here / twitter API 1.1 auth upgrade pattern
Created May 13, 2013 02:43
How to update jQuery $.getJSON twitter API requests from 1.0 to 1.1
<?php
/* code for getting bearer key -- in case this breaks
// from https://dev.twitter.com/docs/auth/application-only-auth
// and http://stackoverflow.com/questions/15503710/twitter-application-only-authentication-php-oauth-error
$consumer_key = '...';
$consumer_secret = '...';
// step 1
'use strict';
console.log('Loading function');
let doc = require('dynamodb-doc');
let dynamo = new doc.DynamoDB();
/**
* Provide an event that contains the following keys:
*
* - operation: one of the operations in the switch statement below