This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const dispatch = e => window.dispatchEvent(e); | |
const handler = subscribe => state => update => action => { | |
const [newState, cmds] = update(state)(action); | |
if (state != newState) { | |
subscribe(newState); | |
} | |
state = newState; | |
if (cmds && cmds.length > 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Fixed h3 numbering http://2ality.com/2012/01/numbering-headingshtml.html */ | |
body { | |
counter-reset: h2counter; | |
} | |
h1 { | |
counter-reset: h2counter; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require("http"); | |
const handle = (req, res) => { | |
let data = ""; | |
req.on("data", chunk => { | |
data += chunk; | |
}); | |
req.on("end", () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const listeners = (function listAllEventListeners() { | |
let elements = []; | |
const allElements = document.querySelectorAll('*'); | |
const types = []; | |
for (let ev in window) { | |
if (/^on/.test(ev)) types[types.length] = ev; | |
} | |
for (let i = 0; i < allElements.length; i++) { | |
const currentElement = allElements[i]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const allCustomElements = []; | |
function isCustomElement(el) { | |
const isAttr = el.getAttribute('is'); | |
// Check for <super-button> and <button is="super-button">. | |
return el.localName.includes('-') || isAttr && isAttr.includes('-'); | |
} | |
function findAllCustomElements(nodes) { | |
for (let i = 0, el; el = nodes[i]; ++i) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Font | |
:set guifont=Source\ Code\ Pro:h14 | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Hide pointless junk at the bottom, doesn't work in .vimrc for some reason? | |
:set laststatus=0 | |
:set noshowmode "don't show --INSERT-- | |
:set noruler "don't show line numbers/column/% junk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import R from 'ramda'; | |
import fs from 'fs'; | |
import { PNG } from 'pngjs'; | |
import pixelmatch from 'pixelmatch'; | |
export const getImages = imagesPaths => { | |
return new Promise(resolve => { | |
let filesRead = 0; | |
let images = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Optimized extends React.PureComponent { | |
render() { | |
return this.props.children | |
} | |
} | |
const SomeConsumer = ({ slice, children } => ( | |
<ActualConsumer> | |
{(state) => ( | |
<Optimized slice={state[slice]}> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm -rf ./node_modules | |
npm cache clear --force | |
npm install | |
# If the problem persists | |
rm ./package-lock.json | |
rm -rf ./node_modules | |
npm cache clear --force | |
npm install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { createElement } from 'react'; | |
import { createStore } from 'redux'; | |
import { render } from 'react-dom'; | |
import { Provider, connect } from 'react-redux'; | |
const ADD = 'ADD'; | |
const store = createStore((state = 0, action) => { | |
if (action.type === ADD) { | |
return ++state; |