Instantly share code, notes, and snippets.

View fileInput.css
.fileContainer {
overflow: hidden;
position: relative;
}
.fileContainer [type=file] {
cursor: inherit;
display: block;
font-size: 999px;
filter: alpha(opacity=0);
View OffFocus.jsx
class OffFocus extends React.Component {
constructor(){
super()
const handler = e => {
if(
this.state.focused
&&
e.target.nodeType
&&
View Drizzle.md

Drizzle

Autumn is here again with its dismal days, and the sun is hiding himself in the darkest corner of the heavens so that no one shall see how pale and aged and worn he has grown in this latter time. But while the wind whistles in the window-chinks and the rain purls in the rainspouts and a wet dog howls in front of a closed gate down below on the street and before the fire has burned down in our tile stove, I will tell you a story about the drizzle. Listen now!

For some time back the good God had become so angered over the wickedness of men that he resolved to punish them by making them still wickeder. He should, in his great goodness, have liked above all things to have drowned them all together in a new Deluge: he had not forgotten how agreeable was the sight when all living creatures perished in the flood. But unfortunately in a sentimental moment he had promised Noah never to do so again.

"Harken, my friend I" he therefore said to the Devil one day. "You are assuredly no saint, but occasionall

View drizzle.txt
THE DRIZZLE
AUTUMN is here again with its dismal days,
and the sun is hiding himself in the darkest
corner of the heavens so that no one shall see how
pale and aged and worn he has grown in this
latter time. But while the wind whistles in the
window-chinks and the rain purls in the rain-
View unfuckReact.js
const mounted = new WeakSet()
export default const unfucker = (component, displayName = component.displayName || component.name || 'React.Component') => {
const host = {
[displayName] : class extends React.Component {
constructor(){
this.state = {}
component.apply(this, arguments)
}
View README.md

jquery.scrollLock.js

Useful for when a blocking user experience is needed (in my case, didn't want people unwittingly loosing their place by scrolling while a modal required their attention): $.scrollLock() locks the body in place, preventing scroll until it is unlocked.

// Locks the page if it's currently unlocked
$.scrollLock();

// ...or vice versa
View Location.es6.min.js
export default x=>document.createElement('a').href=x
View html.loading.snippet.html
<script>
// add a class of 'loading' to the HTML, then remove it once the page has finished loading
(function(c){
c('scripted loading')
window.onload = function(){setTimeout(function(){
c(c().replace('loading',''))
},30)}
}(function(c){
var h = document.lastChild
return c ? h.className = c : h.className
View calendar.es6.js
const calendar = {
controller : ( date = moment() ) => {
const weeks = []
const end = date.endOf( 'month' ).startOf( 'week' )
let current = date.startOf( 'month' ).startOf( 'week' )
do {
weeks.push( {
start : current.clone()
View README.md

Mithril debugger

Prioritised features:

  1. Pointer-based hover-overlay to highlight elements generated by Mithril
  2. With a view of their corresponding vnode & associated path
  3. That allows travel through path and vnode tree interface to highlight other elements

Followed by:

  • Patch reporter:
    • Receive inspectable logs for changes that occur on render