Skip to content

Instantly share code, notes, and snippets.

🍕
please

James jamesplease

🍕
please
Block or report user

Report or block jamesplease

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View PropsType.ts
import PropTypes from 'prop-types';
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type Defined<T> = T extends undefined ? never : T;
/**
* Get the type that represents the props with the defaultProps included.
*
* Alternatively, we could have done something like this:
View deploy-to-now.sh
#!/bin/bash
browser=$1
if [ -z "$browser" ]; then
echo "Usage: ./deploy.sh <browser>"
exit 1
fi
set -euo pipefail
# Copy the right files
@bvaughn
bvaughn / updating-subscriptions-when-props-change-example.js
Last active Aug 10, 2019
Advanced example for manually updating subscriptions in response to props changes in an async-safe way
View updating-subscriptions-when-props-change-example.js
// This is an advanced example! It is not typically required for application code.
// If you are using a library like Redux or MobX, use the container component provided by that library.
// If you are authoring such a library, use the technique shown below.
// This example shows how to safely update subscriptions in response to props changes.
// In this case, it is important to wait until `componentDidUpdate` before removing a subscription.
// In the event that a render is cancelled before being committed, this will prevent us from unsubscribing prematurely.
// We also need to be careful about how we handle events that are dispatched in between
// `getDerivedStateFromProps` and `componentDidUpdate` so that we don't put stale values into the `state`.
@ceejbot
ceejbot / esm_in_node_proposal.md
Last active Jul 17, 2019
npm's proposal for supporting ES modules in node
View esm_in_node_proposal.md

ESM modules in node: npm edition

The proposal you’re about to read is not just a proposal. We have a working implementation of almost everything we discussed here. We encourage you to checkout and build our branch: our fork, with the relevant branch selected. Building and using the implementation will give you a better understanding of what using it as a developer is like.

Our implementation ended up differing from the proposal on some minor points. As our last action item before making a PR, we’re writing documentation on what we did. While I loathe pointing to tests in lieu of documentation, they will be helpful until we complete writing docs: the unit tests.

This repo also contains a bundled version of npm that has a new command, asset. You can read the documentation for and goals of that comma

@ericclemmons
ericclemmons / example.md
Last active Oct 21, 2019
HTML5 <details> in GitHub
View example.md

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 <summary>Summary Goes Here</summary>
anonymous
anonymous / what.js
Created Jul 9, 2015
View what.js
function checkForCompletion(event) {
// assumes source data in sheet named Needed
// target sheet of move to named Acquired
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();
// Ignore edits on sheets other than the first sheet
if (s.getName() !== 'Sheet1') { return; }
View .bach_profile
Johann Sebastian Bach (31 March [O.S. 21 March] 1685 – 28 July 1750) was
a German composer and musician of the Baroque period. He enriched established
German styles through his skill in counterpoint, harmonic and motivic
organisation, and the adaptation of rhythms, forms, and textures from abroad,
particularly from Italy and France. Bach's compositions include the Brandenburg
Concertos, the Goldberg Variations, the Mass in B minor, two Passions, and over
three hundred sacred cantatas of which nearly two hundred survive. His music
is revered for its technical command, artistic beauty, and intellectual depth.
http://en.wikipedia.org/wiki/Johann_Sebastian_Bach
View browserify_for_webpack_users.markdown

browserify for webpack users

There's been a strange explosion in misinformation about browserify recently, particularly in comparisons to webpack.

Generally speaking, most of this confusion stems from how webpack is more willing to pull features into its core to ease discoverability while browserify is more likely to push features out to userland instead.

I think that longer-term, separability has more benefits from a maintenance and

@Fonserbc
Fonserbc / Easing.cs
Last active Oct 14, 2019
Compact and simple easing functions for Unity
View Easing.cs
using UnityEngine;
/*
* Functions taken from Tween.js - Licensed under the MIT license
* at https://github.com/sole/tween.js
*/
public class Easing
{
public static float Linear (float k) {
@ianmetcalf
ianmetcalf / router.js
Created Dec 5, 2014
Chainable Async Router
View router.js
var ChainableRouter = BaseRouter.extend({
constructor: function(options) {
BaseRouter.apply(this, arguments);
this.options = options || {};
this._initRoutes();
},
You can’t perform that action at this time.