Skip to content

Instantly share code, notes, and snippets.

user www-data;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
sendfile on;

Keybase proof

I hereby claim:

  • I am michaelhood on github.
  • I am mh (https://keybase.io/mh) on keybase.
  • I have the public key with fingerprint A60F 1C10 7E4B 4306 CE35  51E2 B3DF 3143 19DC B2E0

To claim this, I am signing this object:

var page = new WebPage(),
address, output, size;
//capture and captureSelector functions adapted from CasperJS - https://github.com/n1k0/casperjs
capture = function(targetFile, clipRect) {
var previousClipRect;
var clipRect = {top: 0, left:0, width: 40, height: 40};
if (clipRect) {
if (!isType(clipRect, "object")) {
throw new Error("clipRect must be an Object instance.");
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

cqlsh> help CREATE_KEYSPACE
CREATE KEYSPACE <ksname> WITH strategy_class = '<strategy>'
[AND strategy_options:<option> = <val>];
The CREATE KEYSPACE statement creates a new top-level namespace (aka
"keyspace"). Valid names are any string constructed of alphanumeric
characters and underscores. Names which do not work as valid
identifiers or integers should be quoted as string literals. Properties
such as replication strategy and count are specified during creation
# $Rev$ from $Date$
# Catalog assumes your InstallESD is at the lastest build available on the Mac App Store. If you are on an older build, uncomment the combo updater.
Installer Disc Builds: 12A269, 12B19, 12C60, 12D78
Output Volume Name: Macintosh HD
Output File Name: 10.8_vanilla
OS Updates:
iTunes 11.0.2 http://appldnld.apple.com/iTunes11/041-9794.20130220.DdPy6/iTunes11.0.2.dmg sha1:e8eba6c2b83b9e24116a9944c808525bed260aa0
@michaelhood
michaelhood / gist:5147482
Created March 12, 2013 22:00
check twitter username availability
function checkusername_twitter() {
res=$(curl -s "https://twitter.com/users/username_available?context=signup&custom=true&email=&full_name=&suggest=1&suggest_on_username=true&username=$1" \
| jq -C -c '{"reason":.reason,"valid":.valid}');
{ echo $res | grep '"valid":true' &>/dev/null; } && after=" .. https://twitter.com/signup?user[screen_name]=$1"
echo ${res}${after}
}

Ideas for improvements to git log --graph

I will maybe someday get around to dusting off my C and making these changes myself unless someone else does it first.

Make the graph for --topo-order less wiggly

Imagine a long-running development branch periodically merges from master. The git log --graph --all --topo-order is not as simple as it could be, as of git version 1.7.10.4.

It doesn't seem like a big deal in this example, but when you're trying to follow the history trails in ASCII and you've got several different branches displayed at once, it gets difficult quickly.

<?php
// This is largely stolen from test.php in the Inline_C repo (https://github.com/pear/Inline_C/blob/master/test.php)
require_once("C.php");
$function1 = <<<EOF
PHP_FUNCTION(times)
{
long i,j;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &i,&j) == FAILURE) {