Skip to content

Instantly share code, notes, and snippets.

View simianarmy's full-sized avatar

Marc Mauger simianarmy

View GitHub Profile
@simianarmy
simianarmy / jsx
Created April 19, 2020 15:34
Partial module mocks with dynamic mocks
import {random} from 'lodash'
jest.mock('lodash', () => {
return {
...jest.requireActual('lodash'),
random: jest.fn(),
}
});
test('get 5', () => {
@simianarmy
simianarmy / gist:59733e4a70de7129a1241357319eef96
Created January 15, 2019 19:39
Execute commands in docker bash
docker exec -it <image-id> bash
@simianarmy
simianarmy / gist:9e48fbec2a00f2db353184b29bb6b409
Last active September 5, 2018 19:09
Checkout by partial branch name
/**
* Checkout branch by partial branch name
* If only matches single branch, checks it out automatically.
* If matches multiple branches, displays selection user can pick from
*
* Usage:
* > gcobr JIRA-1432
* > gcobr partial-branch-name
*/
function gcobr {
@simianarmy
simianarmy / ducks.sh
Created November 5, 2015 17:31
du ducks
du -cks * | sort -rn | head
@simianarmy
simianarmy / findlargedirs.sh
Last active November 5, 2015 17:32
Find large directories
for i in G M K; do du -ah | grep [0-9]$i | sort -nr -k 1; done | head -n 11
@simianarmy
simianarmy / findlargefiles.sh
Created August 27, 2015 21:59
Find large files
find / -xdev -type f -size +100M
@simianarmy
simianarmy / walk_2_dirs.sh
Last active August 29, 2015 14:25
Loop semi-recursively through directories for batch shell operations
for d in `ls`; do pushd $d; for l in `ls`; do YOUR_COMMANDS_HERE; done; popd; done;
@simianarmy
simianarmy / config.json
Created October 2, 2013 00:36 — forked from anonymous/config.json
Cool exploding tile css custom filter from Adobe CSS FilterLab
{
"hasVertex": true,
"hasFragment": true,
"mix": {
"blendMode": "normal",
"compositeOperator": "source-atop"
},
"mesh": {
"columns": 100,
"rows": 100
@simianarmy
simianarmy / active_record_extensions.rb
Created November 17, 2011 18:26
Explicitly add tables' engine in schema.rb dump
module ActiveRecord
class SchemaDumper
# Monkeypatch table() to support mixed-engine database schemas by
# making the table engine explicit
def table(table, stream)
columns = @connection.columns(table)
begin
tbl = StringIO.new
@simianarmy
simianarmy / custom-memcached-chef
Created October 18, 2011 00:12
custom memcached Chef recipe
require 'pp'
#
# Cookbook Name:: memcached
# Recipe:: default
#
node[:applications].each do |app_name,data|
user = node[:users].first
case node[:instance_role]