Skip to content

Instantly share code, notes, and snippets.

View CodingDive's full-sized avatar
🎯
Focusing

Mikey Stengel CodingDive

🎯
Focusing
View GitHub Profile
const i = 'gfudi';
const k = s => s.split('').map(c => String.fromCharCode(c.charCodeAt() - 1)).join('');
self[k(i)](urlWithYourPreciousData);
@ryanflorence
ryanflorence / FiniteMachine.js
Created December 1, 2017 21:06
finite-machine.js
import React, { Component } from "react"
import { Machine } from "xstate"
import * as PropTypes from "prop-types"
class FiniteMachine extends Component {
machine = Machine(this.props.chart)
state = {
data: this.props.reducer(undefined, { type: "@init" }),
machineState: this.machine.getInitialState()
// node --harmony-async-iteration async-iteration-test.js
// for-await-of converts sync iterables over Promises to async iterables over fulfillment values
// Iterable<Promise<T>> -> AsyncIterable<T>
// Roughly: { value: Promise.resolve(123), done: false } becomes Promise.resolve({ value: 123, done: false })
// Spec: https://tc39.github.io/proposal-async-iteration/#sec-createasyncfromsynciterator
function* gen() {
yield Promise.resolve(1);
@mikeal
mikeal / count-npm-dependencies.js
Created February 16, 2016 00:49
Calculate the average number of dependencies in all modules on npm.
var request = require('request')
, JSONStream = require('JSONStream')
, deps = []
request('https://skimdb.npmjs.com/registry/_all_docs?include_docs=true')
.pipe(JSONStream.parse('rows.*.doc'))
.on('data', function (obj) {
// project against outdated or broken package.json
if (!obj['dist-tags']) return
if (!obj['dist-tags'].latest) return
@Restuta
Restuta / framework-sizes.md
Last active June 11, 2025 03:17
Sizes of JS frameworks, just minified + minified and gzipped, (React, Angular 2, Vue, Ember)

Below is the list of modern JS frameworks and almost frameworks – React, Vue, Angular, Ember and others.

All files were downloaded from https://cdnjs.com and named accordingly. Output from ls command is stripped out (irrelevant stuff)

As-is (minified)

$ ls -lhS
566K Jan 4 22:03 angular2.min.js
@jagregory
jagregory / gist:710671
Created November 22, 2010 21:01
How to move to a fork after cloning
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy.
* Off the top of my head *
1. Fork their repo on Github
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it
git remote add my-fork git@github...my-fork.git