Skip to content

Instantly share code, notes, and snippets.

View lukekarrys's full-sized avatar

Luke Karrys lukekarrys

View GitHub Profile
@lukekarrys
lukekarrys / README.md
Last active January 3, 2018 06:36
postpass

postpass

This is a workaround to tie together one of my custom workflows to an API.

All it does is:

  1. Setup a server that accepts POSTs to /
  2. Pass through any headers
  3. POST any from the data key to the url key
@lukekarrys
lukekarrys / README.md
Last active October 5, 2017 19:35
MLB Season Streaks

mlb-season-streaks

I was curious about the Cubs 2016 season and what it looked liked broken into chunks of 10 games (or some other nuber). I was also curious with how it stacked up against the 2001 Mariners.

Here's how to run it:

npm install
node index 2016-CHC 10
# Then look at the output
@lukekarrys
lukekarrys / README.md
Last active December 7, 2016 17:46
eslint-plugin-import 2.0.0 newline-after-import rule crash
@lukekarrys
lukekarrys / README.md
Last active March 20, 2018 14:59
ios8-transform-react-inline-elements-with-core-js-shim-bug
@lukekarrys
lukekarrys / README.md
Last active December 7, 2016 17:48
react-router-redux bug
@lukekarrys
lukekarrys / README.md
Last active December 7, 2016 17:48
Get the keys of a nested object in dot notation.

string-keys

import keys from 'string-keys'

keys({
  a: 1,
  b: 2,
  c: null,
 d: {
@lukekarrys
lukekarrys / README.md
Last active December 7, 2016 17:49
npm3 conflicting subdependencies and what ends up at the top level of node_modules

npm3 conflicting subdependencies and what ends up at the top level of node_modules

Linked to from http://lukecod.es/2015/12/04/npm3-top-level-nested-conflicting-dependencies/

In npm3 conflicting versions of shared sub-dependencies will end up at the top level based on which is installed first.

This isn't a problem, just something to be aware of in case you are relying on something being at the top of node_modules (which you really shouldn't be).

Usage

@lukekarrys
lukekarrys / README.md
Last active December 7, 2016 17:54
history module npm tarball weirdness

history module npm tarball weirdness

Linked to from npm/npm#9642

Steps to repro

  • git clone git@gist.github.com:7ba04eb61a8d88f933fc.git
  • cd 7ba04eb61a8d88f933fc
  • npm install
  • npm pack
  • tar xzf history-huh-1.0.0.tgz
@lukekarrys
lukekarrys / README.md
Last active December 7, 2016 17:52
browserify module dupes

browserify module dupes

Usage

browserify --list entry.js | ./deps-ids.js

Transforms the output from browserify --list from the full paths of modules to a module "id" which is the name of the npm module + filename within the module. This only works for detecting npm modules currently and not local files. It also counts them so you can easier see if you are including multiple of the same module in your bundle.

Example

@lukekarrys
lukekarrys / exportDir.js
Created March 16, 2015 07:42
Write an index file to a directory which a require for each file in the dir
var fs = require('fs');
var path = require('path');
var filename = function (file) {
return path.basename(file, path.extname(file));
};
module.exports = function exportDirectory (dir) {
var dirPath = path.resolve(__dirname, dir);