View unfuckReact.js
const mounted = new WeakSet()
class unfucked extends React.Component {
constructor(){
this.state = {}
}
componentDidMount(){
mounted.add(this)
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 EventComponent.js
// EventComponents have a `handlers` hash which they can use to listen for DOM events on the document.
// These are bound and unbound safely to avoid lifecycle race condition exceptions.
export default class EventComponent extends React.Component {
componentDidMount() {
for(const key in this.events || {})
$(document).on(key, this.events[key])
}
componentWillUnmount() {
for(const key in this.events || {})
View fileInput.css
.fileContainer {
overflow: hidden;
position: relative;
}
.fileContainer [type=file] {
cursor: inherit;
display: block;
font-size: 999px;
filter: alpha(opacity=0);
View patdj.js
function patdj(target, update, preserve = true) {
if (update.nodeType != 1 && update.nodeType == target.nodeType)
target.nodeValue = update.nodeValue
else if (update.nodeType != target.nodeType || update.tagName !== target.tagName || update.type !== target.type){
const { nextSibling, parentNode } = target;
const replacement = preserve ? update.cloneNode(true) : update;
parentNode.removeChild(target);
View Drag.js
import m from 'mithril'
import {stream} from 'flyd'
import PointerStream from 'pointer-stream'
// The component state object is provided wholesale for the author API, therefore we store our internal API state in a Map
const= new Map()
// Bind a temporal vnode to the private store associated with its persistent state
// This allows us to reliably access the last render's dom and attribute data
function update(vnode){
View component.js
componentDidMount() {
fetchPosts().then(({posts}) => {
this.setState({posts});
});
fetchComments().then(({comments}) => {
this.setState({comments});
});
}
View stalling-list.1684.js
export default {
onbeforeupdate(now, then){
const keys = now.children.map(({key}) => key)
const departed = then.children.filter(({key}) => !keys.includes(key))
if(!departed.length)
return true
const departures = departed.map(vnode =>
View animator.js
var animating = false;
// Define an animator consisting of optional incoming and outgoing animations.
// alwaysAnimate is false unless specified as true: false means an incoming animation will only trigger if an outgoing animation is also in progress.
// forcing dontClone to true means the outward animation will use the original element rather than a clone. This could improve performance by recycling elements, but can lead to trouble: clones have the advantage of being stripped of all event listeners.
function animator( incoming, outgoing, alwaysAnimate, dontClone ){
// The resulting animator can be applied to any number of components
return function animate( x, y, z ){
var config;
var parent;
View mRouteStream.js
import m from 'mithril'
import stream from 'mithril/stream/stream'
export default function routeStream(
defaultRoute = '/',
routes = ['/:path...']
){
const routeStream = stream()
m.route(