Skip to content

Instantly share code, notes, and snippets.

@jrop
jrop / tslint.json
Last active May 4, 2017 17:46
TSLint.json
{
"extends": ["tslint-react"],
"rules": {
"jsx-alignment": false,
"jsx-curly-spacing": [true, "never"],
"jsx-no-bind": true,
"jsx-no-lambda": false,
"jsx-no-multiline-js": false,
"jsx-wrap-multiline": false,
@jrop
jrop / async-await.js
Created March 8, 2017 17:52
async readdir (Node.JS)
const flatten = require('flatten')
const fs = require('mz/fs')
const path = require('path')
async function isDirectory(f) {
return (await fs.stat(f)).isDirectory()
}
async function readdir(filePath) {
const files = await Promise.all((await fs.readdir(filePath)).map(async f => {
@jrop
jrop / package.json
Last active December 18, 2016 21:33
A script to pull/clone all GitHub repositories for a given account
{
"name": "pull-all",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"co": "^4.6.0",
"colors": "^1.1.2",
"execa": "^0.5.0",
"generic-pool": "^3.1.4",
@jrop
jrop / gen-self-signed.js
Created November 3, 2016 16:44
Generate a self-signed certificate using Node.JS
'use strict'
const selfsigned = require('selfsigned')
const pems = selfsigned.generate(null, {
days: 365 * 10,
keySize: 2048,
algorithm: 'sha256',
})
console.log(pems.private)
console.log(pems.public)
@jrop
jrop / .profile
Created October 20, 2016 18:02
Command not found
#!/bin/bash
prompt="$(PS1="$PS1" echo -n | bash --norc -i 2>&1)";
while [ true ]; do
echo -n "${prompt%exit}";
read line;
echo "-bash: $line: command not found";
done
@jrop
jrop / package.json
Created September 30, 2016 19:02
Webpack Config for react-toolbox
{
"name": "react-toolbox-sandbox",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack --progress",
"buildw": "webpack -w --progress",
"buildp": "NODE_ENV=production webpack --progress",
"clean": "rm -rf build/"
@jrop
jrop / slowdash.go
Created July 8, 2016 20:39
Slowdash (Golang)
package main
import (
"fmt"
"reflect"
"sort"
)
// Item is a generic item
// type Item interface{}
#
# Docker
#
eval $(docker-machine env default)
alias dip="docker-machine ip default"
alias d="docker"
alias dm="docker-machine"
alias dclean="d images; echo ========; d images | grep '<none>' | tr -s ' ' | cut -d ' ' -f 3 | cut -d ':' -f 2 | xargs -n 1 echo docker rmi"
@jrop
jrop / toQueryString.js
Created July 14, 2015 19:46
toQueryString.js
function toQueryString(obj, urlEncode) {
//
// Helper function that flattens an object, retaining key structer as a path array:
//
// Input: { prop1: 'x', prop2: { y: 1, z: 2 } }
// Example output: [
// { path: [ 'prop1' ], val: 'x' },
// { path: [ 'prop2', 'y' ], val: '1' },
// { path: [ 'prop2', 'z' ], val: '2' }
// ]
@jrop
jrop / .babelrc
Last active March 3, 2017 17:46
Simple gulpfile.js
{
"presets": [ "latest", "react" ],
"plugins": [ "transform-runtime" ]
}