Skip to content

Instantly share code, notes, and snippets.

View ourmaninamsterdam's full-sized avatar

Justin Perry ourmaninamsterdam

View GitHub Profile
@ourmaninamsterdam
ourmaninamsterdam / Preferences.sublime-settings
Last active March 30, 2016 11:13
SublimeText 3 User Settings
{
"auto_close_tags": false,
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme",
"dictionary": "Packages/Language - English/en_GB.dic",
"enable_telemetry": false,
"file_exclude_patterns":
[
"*.scssc",
@ourmaninamsterdam
ourmaninamsterdam / Default.sublime-theme
Last active March 4, 2016 12:00
Sublime Text 3 Monokai Sidebar theme
[
{
"class": "sidebar_container",
"layer0.tint": [60, 60, 60],
"layer0.opacity": 1.0,
"layer0.draw_center": false,
"layer0.inner_margin": [0, 0, 1, 0],
"content_margin": [0, 0, 1, 0]
},
{
@ourmaninamsterdam
ourmaninamsterdam / .hgrc
Last active September 26, 2017 14:29
My Mercurial setup
# example user config (see "hg help config" for more info)
[ui]
# name and email, e.g.
username =
#username =
merge = diffmerge
editor = /usr/bin/vim
[extensions]
# uncomment these lines to enable some popular extensions
[
{ "keys": ["super+shift+r"], "command": "reveal_in_side_bar"}
]
bz2
Emmet Css Snippets
JSHint
MacTerminal
PyV8
SublimeLinter
tern_for_sublime
Default (OSX).sublime-keymap
Distraction Free.sublime-settings
@ourmaninamsterdam
ourmaninamsterdam / map-cmdline.lg
Last active April 6, 2017 08:18
A nicer hg log
changeset = '\033[0;31m{rev}:{phase}: \033{node|short} \033[0;34m{author|person}\033[0m {desc|firstline|strip} \033[0;32m({date|age}){branches}{bookmarks}{tags}'
changeset_verbose = '\033[0;31m{rev}:{node|short}:{phase} \033[0;34m{author|person}\033[0m {desc|firstline|strip} \033[0;32m({date|age}) {branches}{bookmarks}{tags}'
start_branches = ' '
branch = '\033[0;31m{branch}\033[0m'
start_bookmarks = ' '
bookmark = '\033[0;31m[{bookmark}]\033[0m '
last_bookmark = '\033[0;31m[{bookmark}]\033[0m'
@ourmaninamsterdam
ourmaninamsterdam / gist:9ddf1dc1d8c89aa5ee5924e377fb8cf8
Created January 25, 2018 15:53
WIP spawn supervisor with glob ignore
const globby = require("globby");
const { spawn } = require("child_process");
const pattern = [
"node_modules/**/!(*.*)",
"!node_modules/**/node_modules/",
"!node_modules/wwfeatures-common/node_modules/"
];
function startSpawn(ignore) {
@ourmaninamsterdam
ourmaninamsterdam / hoc-testing.jsx
Created March 14, 2018 15:38
Testing inner component of HOC using Enzyme
const DummyComponent = () => <div>Dummy</div>;
const Component = getComposedComponent(DummyComponent);
const component = mount(
shallow(<Component foo={true} />).get(0)
);
eventMap.resize();
expect(component.state().fooBar).toBe(true);
@ourmaninamsterdam
ourmaninamsterdam / gist:d5cb3d2ad91d1022c01cfe05c43db914
Last active October 11, 2019 13:10
Split string, flatten and convert ranges to array of numbers
"1,40-44"
.split(',')
.map(item => item.trim().split('-')
.map(item => parseInt(item.trim()))) // [[1], [40,44]]
"2-3,10,12,45,46-59"
.split(',')
.map(item => item.trim().split('-')
.map(item => parseInt(item.trim()))) // [[2,3], [10,12,45], [46,59]]
@ourmaninamsterdam
ourmaninamsterdam / mapKeys.js
Created October 14, 2019 17:33
Maps array of objets to a key value object using key provided
const mapKeys = (collection, rootKey) => {
const obj = {};
collection.forEach(item => {
obj[item[rootKey]] = item;
});
return obj;
};
const justins = [{id: 1, name: 'Justin Bieber'},{id: 2, name: 'Justin Timberlake'},{id: 3, name: 'Justin Time'}];