Add a one-sentence description of this project. and a link to the live demo.
- completed feature: What this feature does
- pending feature: What this feature does
package main | |
import ( | |
"bufio" | |
"flag" | |
"fmt" | |
"io" | |
"os" | |
"path/filepath" | |
"regexp" |
#!/bin/bash | |
# | |
# Watch current directory (recursively) for file changes, and execute | |
# a command when a file or directory is created, modified or deleted. | |
# | |
# Written by: Senko Rasic <[email protected]> | |
# | |
# Requires Linux, bash and inotifywait (from inotify-tools package). | |
# | |
# To avoid executing the command multiple times when a sequence of |
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine | |
# This is how I upload my new Sol Trader builds (http://soltrader.net) | |
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash | |
S3KEY="my aws key" | |
S3SECRET="my aws secret" # pass these in | |
function putS3 | |
{ | |
path=$1 |
function promiseMap(xs, f) { | |
const reducer = (ysAcc$, x) => | |
ysAcc$.then(ysAcc => f(x).then(y => ysAcc.push(y) && ysAcc)); | |
return xs.reduce(reducer, Promise.resolve([])); | |
} | |
/* Example */ | |
const axios = require('axios'); |
// Author: Renat Tuktarov ([email protected]) | |
const retry = function(fn, prev) { | |
return new Promise((current, reject) => { | |
const resolve = _ => (prev && prev()) || current(); | |
fn(resolve, delay => { | |
setTimeout(_ => { | |
retry(fn, resolve); | |
}, delay); |
/* | |
Sort array of objects based on another array | |
Original function: | |
function mapOrder (array, order, key) { | |
array.sort( function (a, b) { | |
var A = a[key], B = b[key]; | |
if (order.indexOf(A) > order.indexOf(B)) { | |
return 1; | |
} else { |
Add a one-sentence description of this project. and a link to the live demo.
/* Extend the Underscore object with the following methods */ | |
// Rate limit ensures a function is never called more than every [rate]ms | |
// Unlike underscore's _.throttle function, function calls are queued so that | |
// requests are never lost and simply deferred until some other time | |
// | |
// Parameters | |
// * func - function to rate limit | |
// * rate - minimum time to wait between function calls | |
// * async - if async is true, we won't wait (rate) for the function to complete before queueing the next request |
/* | |
* node-ws - pure Javascript WebSockets server | |
* Copyright Bradley Wright <[email protected]> | |
*/ | |
// Use strict compilation rules - we're not animals | |
'use strict'; | |
var net = require('net'), | |
crypto = require('crypto'); |
$ tmux # start tmux server
$ tmux at # attach running sessions to a terminal
$ tmux ls # list running tmux sessions
$ tmux new -s session_name # make new named session
$ tmux at -t session_name # attach to exist session (allowing shared sessions)