Skip to content

Instantly share code, notes, and snippets.

@nisaacson
nisaacson / status.sh
Created August 14, 2014 19:04
Get the status of all jobs from the kue api
#!/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 August 29, 2015 14:02
Align code on the = sign with a key mapping using the EasyAlign Plugin https://github.com/junegunn/vim-easy-align
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 February 26, 2014 17:23
Use tern with vim for node.js development.
{
"libs": [
"browser",
"underscore",
"jquery"
],
"plugins": {
"node": {}
}
}
@nisaacson
nisaacson / parse-timezone-default.js
Created February 7, 2014 21:22
Parse timestamp strings with timezones. Use Denver timezone if timezone is 00 (ie not set).
// 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 January 2, 2016 10:39
Use vagrant and docker to quickly start a riak server. Supports virtualbox and vmware_fusion providers

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 March 8, 2018 20:55
Javascript resources
@nisaacson
nisaacson / README.md
Last active December 9, 2019 01:17
Vim Javascript indentation via esformatter. Idea insired by http://yieldthedog.github.io/blog/2013/03/01/invoke-js-beautify-in-vim/
@nisaacson
nisaacson / fleetHub.xml
Created March 22, 2013 01:49
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
<?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 December 15, 2015 06:39
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
<?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>