Skip to content

Instantly share code, notes, and snippets.

@nisaacson
nisaacson / status.sh
Created Aug 14, 2014
Get the status of all jobs from the kue api
View status.sh
#!/usr/bin/env bash
KUE_URL="http://localhost:9090/jobs"
DATE=$(date +"%Y-%m-%d")
FOLDER="kue-status_$DATE"
function get_status {
STATUS=$1
STATUS_URL="$KUE_URL/$STATUS/0..9999"
FILE_PATH="$FOLDER/$STATUS.json"
echo "getting jobs from kue at url: $STATUS_URL"
@nisaacson
nisaacson / align.vim
Last active Aug 29, 2015
Align code on the = sign with a key mapping using the EasyAlign Plugin https://github.com/junegunn/vim-easy-align
View align.vim
Bundle 'junegunn/vim-easy-align'
map <Leader>r :call EnterAlign()<cr>
function! EnterAlign()
let save_cursor = getpos(".")
let l:win_view = winsaveview()
:execute "normal vip\<Enter>="
call winrestview(l:win_view)
call setpos('.', save_cursor)
endfunction
@nisaacson
nisaacson / .tern-project
Created Feb 26, 2014
Use tern with vim for node.js development.
View .tern-project
{
"libs": [
"browser",
"underscore",
"jquery"
],
"plugins": {
"node": {}
}
}
@nisaacson
nisaacson / parse-timezone-default.js
Created Feb 7, 2014
Parse timestamp strings with timezones. Use Denver timezone if timezone is 00 (ie not set).
View parse-timezone-default.js
// Denver ISO 8601 Offset
// see https://github.com/moment/moment/issues/1422#issuecomment-32908589
var DEFAULT_TIMEZONE_OFFSET = '-07:00'
var moment = require('moment')
console.log(parseTime('2013-01-01T00:00:00-02:00'))
console.log(parseTime('2013-01-01 00:00:00'));
function parseTime(input) {
@nisaacson
nisaacson / README.md
Last active Jan 2, 2016
Use vagrant and docker to quickly start a riak server. Supports virtualbox and vmware_fusion providers
View README.md

Usage

cd /path/to/this/gist
vagrant up --provision

After the virtual machine has started up and finished provisioning, open a web browser to http://localhost:8098 to confirm that riak is running.

Enable search

@nisaacson
nisaacson / gist:7862784
Last active Mar 8, 2018
Javascript resources
View gist:7862784
@nisaacson
nisaacson / README.md
Last active Dec 9, 2019
Vim Javascript indentation via esformatter. Idea insired by http://yieldthedog.github.io/blog/2013/03/01/invoke-js-beautify-in-vim/
View README.md
@nisaacson
nisaacson / fleetHub.xml
Created Mar 22, 2013
Sets up a service to run a persistant fleet hub on SmartOS. On line 26 there is a command to startHub.sh. This is a simple script which runs a fleet drone and is included here See https://github.com/isaacs/joyent-node-on-smart-example for instructions on how to install a configuration xml file like this one on SmartOS
View fleetHub.xml
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="fleet-hub-service">
<service name="site/fleet-hub-service" type="service" version="1">
<create_default_instance enabled="true"/>
<single_instance/>
<dependency name="network" grouping="require_all" restart_on="refresh" type="service">
<service_fmri value="svc:/milestone/network:default"/>
</dependency>
@nisaacson
nisaacson / fleetDrone.xml
Last active Dec 15, 2015
Sets up a service to run a persistant fleet drone on SmartOS. On line 26 there is a command to startDrone.sh. This is a simple script which runs a fleet drone and is included here See https://github.com/isaacs/joyent-node-on-smart-example for instructions on how to install a configuration xml file like this one on SmartOS
View fleetDrone.xml
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="fleet-drone-service">
<service name="site/fleet-drone-service" type="service" version="1">
<create_default_instance enabled="true"/>
<single_instance/>
<dependency name="network" grouping="require_all" restart_on="refresh" type="service">
<service_fmri value="svc:/milestone/network:default"/>
</dependency>