Skip to content

Instantly share code, notes, and snippets.

@sandfox
sandfox / gist:acf01019a91858048b6b34af366cc700
Created April 25, 2018 15:32
trim local branches in git
git checkout mater git branch --merged | egrep -v "(^\*|master)" | xargs git branch -d
git remote prune origin
@sandfox
sandfox / import-assign.js
Created April 20, 2018 09:41
finding some lodash imports
/**
* node import-assign.js path/to/folder/to/scan
*/
const fs = require('fs')
const path = require('path')
const { loadFileSync } = require('babel-file-loader');
const readdir = require('recursive-readdir');
const { sortBy, sortedUniq, flowRight, identity } = require('lodash/fp')
@sandfox
sandfox / fix-lodash-imports
Last active April 11, 2018 18:42
one off script to mixup lodash imports in a project
#! /usr/bin/env node
/**
* ./fix-lodash-imports path/to/file.js
*/
const fs = require('fs');
const loadFile = filepath => fs.readFileSync(filepath, 'utf8');
const writeFile = (filepath, data) => fs.writeFileSync(filepath, data, 'utf8');
@sandfox
sandfox / README.md
Created March 26, 2018 09:51
Some scripts to remove husky hooks and convert them to chowchow hooks

Some scripts to remove husky hooks and convert them to chowchow hooks

./convert-githooks.sh && ./remove-hooks.sh
@sandfox
sandfox / README.md
Created March 6, 2018 15:29
some tool to build.

Jamie Dixon [3:16 PM]

I’d like to answer the question “I’m testing this URL, is the change you made in this version?” when asked by a tester or PM

@sandfox
sandfox / Gemfile
Last active February 27, 2018 10:42
travis conditionals debugging
source 'https://rubygems.org'
gem 'travis-conditions'
/*
injectExamples.js - inject examples into the README
The MIT License (MIT)
Copyright (c) 2013-2017 Tristan Slominski
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
@sandfox
sandfox / delete_all_hooks.sh
Created February 12, 2018 11:48
delete all hooks from a git repo
#! /usr/bin/env bash
set -e
shopt -s extglob
HOOKDIR="$(git rev-parse --git-dir)/hooks"
if [ -d "$HOOKDIR" ]; then
rm -rf "${HOOKDIR:?}"/!(*.sample)
@sandfox
sandfox / delete_husky_hooks.sh
Last active February 11, 2018 15:51
delete husky git hooks
#! /usr/bin/env sh
set -e
HOOKDIR="$(git rev-parse --git-dir)/hooks"
if [ -d "$HOOKDIR" ]; then
grep -r -l "#husky 0.14.3" "$HOOKDIR" | xargs -0 rm -f --
echo "husky hooks removed from $HOOKDIR"
else
#! /usr/bin/env node
// Usage cat some-file.json | jpoo path.to.Key
// Needed the ability to parse + fetch a key from a string of JSON sent to
// stdin and be cross platfrom which ruled out jq, and should work with node 4 - BITE ME!
const stdin = process.stdin;
getStdin = () => {
let ret = '';