Skip to content

Instantly share code, notes, and snippets.

View vincentmac's full-sized avatar

Vincent Mac vincentmac

View GitHub Profile
@vincentmac
vincentmac / gist:9ee0c31090727f8fa6f0c87eb9562dac
Last active January 23, 2019 00:11
Shakespeare - All's Well that Ends Well (12669 Characters)
1603
ALLS WELL THAT ENDS WELL
by William Shakespeare
Dramatis Personae
KING OF FRANCE
@vincentmac
vincentmac / gist:9403609
Created March 7, 2014 01:57
keybase.md
### Keybase proof
I hereby claim:
* I am vincentmac on github.
* I am vincent (https://keybase.io/vincent) on keybase.
* I have a public key whose fingerprint is E4E4 BE49 696B 7C7D C436 F2D8 A95E 37A9 D355 5AAC
To claim this, I am signing this object:
@vincentmac
vincentmac / sublime-text-osx-context-menu.md
Created September 25, 2013 18:03
Sublime Text OSX Context Menu

Add Sublime Text to OS X Context Menu

  • Open Automator
  • Create a new Service
  • Add a Run Shell Script action
  • Set input to Service receives selected files or folders in any application
  • Set the script action to /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n $@
  • Set Pass input to as arguments
  • Save as Open in Sublime Text
@vincentmac
vincentmac / riak commands
Created December 14, 2012 09:05
riak commands
curl -v -X HEAD -d '{"username":"vincent"}' -H "Content-Type: application/json" http://127.0.0.1:5000/api/users/search
curl -v -d '{"username":"vincent"}' -H "Content-Type: application/json" http://127.0.0.1:5000/api/users/search
Search for all users
http://127.0.0.1:8091/riak/users?keys=true # List all keys, old format
http://127.0.0.1:8091/buckets/users/keys?keys=true # List all keys, new format
http://127.0.0.1:8091/solr/users/select?q=username%3Atestuser&rows=10000&wt=json
Search for all accounts
@vincentmac
vincentmac / wordwrap.js
Created November 20, 2012 02:13
JS wordwrap
// Vincent Mac
// coded up answer to what John had asked me.
// Wrapped in anonymous function to prevent polution of global namespace.
(function() {
"use strict";
var maxWidth = 50; // desired column width in number of characters
var paragraph = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
// var paragraph = "one two three four five six seven eight nine ten";
@vincentmac
vincentmac / node-events-emitters-named-listeners.js
Created October 11, 2012 23:12
Node.js problem getting event emitters to use named functions with arguments
/**
* The way I can currently get event emitters working.
* Look at the `.on` handler.
*
* Why do I have to wrap the listener function `executeSomeWork` in an
* anonymous function when I want to pass an argument from the emitter?
*/
function executeSomeWork(stuff) {
console.log(stuff);
@vincentmac
vincentmac / rcluster
Created September 22, 2012 23:16
sh:riak dev cluster start|stop
#!/bin/sh
# Vincent Mac
# Simple start/stop script for launching Riak Cluster for local development or fast track
# After building your dev environment using `make devrel`, place this script in the `dev` folder
# Identify the script name
SCRIPT=`basename $0`
case "$1" in
start)
@vincentmac
vincentmac / user.js
Created August 29, 2012 18:36
Riak-js: User Model
/*!
* user.js
* User Model using Riak as a datastore
*/
/**
* Model dependencies
*/
var db = require('riak-js').getClient({debug: true, port:8091, api: 'http'});
@vincentmac
vincentmac / models.user.js
Created August 29, 2012 18:33
Riak-js: User Model Test
// models.user.js
// User Model Tests
// Chai Assertion Library
var chai = require('chai')
, expect = chai.expect
, should = chai.should()
, User = require('../models/user');
chai.Assertion.includeStack = true; // defaults to false
@vincentmac
vincentmac / bash:riak cluster start
Created August 27, 2012 19:12
bash:riak dev cluster start
#! bash
# cli for loop to start riak dev cluster
for i in {1..4}; do dev$i/bin/riak start; done