Skip to content

Instantly share code, notes, and snippets.

@jrop
jrop / iab.js
Created April 11, 2014 18:35
cordova-in-app-browser-utilities
/*
* Utilities for managing popups easily in Apache Cordova
* Use like:
*
* ...
* <script src="path/to/cordova.js"></script>
* <script src="path/to/this/file/iab.js"></script>
* ...
*
* Also, be sure that the InAppBrowser plugin is
@jrop
jrop / q-while.js
Last active August 29, 2015 14:20
Q.while
var Q = require('q')
Q.while = (conditionCallback, stepCallback) => {
var deferredWhile = Q.defer()
//
// CONDITION
//
// This is where the condition checking happens:
// 1) check the conditional
@jrop
jrop / .babelrc
Last active March 3, 2017 17:46
Simple gulpfile.js
{
"presets": [ "latest", "react" ],
"plugins": [ "transform-runtime" ]
}
@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' }
// ]
#
# 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 / slowdash.go
Created July 8, 2016 20:39
Slowdash (Golang)
package main
import (
"fmt"
"reflect"
"sort"
)
// Item is a generic item
// type Item interface{}
@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 / .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 / 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 / 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",