Skip to content

Instantly share code, notes, and snippets.

View OutThisLife's full-sized avatar
🏠
Working from home

brooklyn! OutThisLife

🏠
Working from home
View GitHub Profile
@OutThisLife
OutThisLife / deps
Last active April 21, 2018 07:04
rollup config
"babel-cli": "latest",
"babel-core": "latest",
"babel-eslint": "latest",
"babel-plugin-external-helpers": "latest",
"babel-plugin-styled-components": "latest",
"babel-plugin-transform-object-rest-spread": "latest",
"babel-preset-env": "latest",
"babel-preset-flow": "latest",
"babel-preset-react": "latest",
"eslint-plugin-flowtype-errors": "latest",
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
@OutThisLife
OutThisLife / log.js
Last active July 26, 2018 15:17
Simple template-literal colorized logger --- log.info`The only thing that will highlight is ${thisVariableHere}`
/**
* Example usage:
log.warn`Some message with ${variables} highlighted`;
log.blue`Some message everything highlighted`;
log.info`Some message with ${variables} highlighted`;
log.blueBG`Some message everything highlighted`;
*/
const colours = {
reset: '\x1b[0m',
@OutThisLife
OutThisLife / evts.js
Created July 27, 2018 19:48
Get all event listeners from chrome.
// This is to list all events on the page:
[].slice.call(document.querySelectorAll('*'))
.map(el => ({ el, listeners: Object.entries(getEventListeners(el)) }))
.filter(el => el.listeners.length)
// Use with a mutationobserver to confirm that events are detaching:
const _getEventListeners = getEventListeners
const getAll = () => [].slice.call(document.querySelectorAll('*'))
.map(el => ({ el, listeners: Object.entries(_getEventListeners(el)) }))
.filter(el => el.listeners.length)
@OutThisLife
OutThisLife / bitwise-hacks.js
Created July 27, 2018 21:41 — forked from leodutra/bitwise-hacks.js
Fast Int Math + Bitwise Hacks For JavaScript
// http://michalbe.blogspot.com.br/2013/03/javascript-less-known-parts-bitwise.html
// http://jsperf.com/bitwise-vs-math-object
// http://united-coders.com/christian-harms/results-for-game-for-forfeits-and-the-winner-is/
// https://mudcu.be/journal/2011/11/bitwise-gems-and-other-optimizations/
// https://dreaminginjavascript.wordpress.com/2009/02/09/bitwise-byte-foolish/
// http://jsperf.com/math-min-max-vs-ternary-vs-if/24
"use strict";
var PI = Math.PI;
const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args)))
const set: number[] = [
...Array(1 + (parseInt(process.argv[2], 10) || 10)).keys()
]
const graph = set
.reduce<number[][]>(
(acc, i) => (acc[i] = set.filter(j => j)) && acc.sort(),
[]
)
.map(g => g.sort((a, b) => a - b))
@OutThisLife
OutThisLife / withSelection.tsx
Created November 27, 2018 01:41
drag select rows
import { withHandlers } from 'recompose'
export default withHandlers<{}, SelectionsProps>(() => ({
handleMouse: () => ({ currentTarget: $parent, target, shiftKey, button }) => {
if (button || !(target instanceof HTMLElement)) {
return
}
const $rows = [].slice.call($parent.getElementsByClassName('row'))
const $first = $parent.querySelector('[data-checked]')
@OutThisLife
OutThisLife / adx.ts
Created November 27, 2018 14:14
shopster_adx
declare lower;
declare once_per_bar;
input n = 14;
def gd_88 = high - high[1];
def gd_96 = low[1] - low;
def gda_104;
def gda_108;
@OutThisLife
OutThisLife / server.ts
Last active November 28, 2018 03:44
server.ts
import * as compression from 'compression'
import * as express from 'express'
import { RequestHandlerParams } from 'express-serve-static-core'
import * as helmet from 'helmet'
import * as LRU from 'lru-cache'
import * as morgan from 'morgan'
import * as next from 'next'
import * as path from 'path'
const dev = process.env.NODE_ENV !== 'production'