Skip to content

Instantly share code, notes, and snippets.

:atom:
Ignoring most things

Brandon Dail aweary

:atom:
Ignoring most things
Block or report user

Report or block aweary

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 fancy-console.js
console.groupWithTrace = (name, fn) => {
console.group(name);
fn();
console.groupCollapsed();
console.trace(name);
console.groupEnd();
console.groupEnd();
};
function add(x, y) {
View App.js
import React from "react";
import useMutableReducer from "./useMutableReducer";
const reducer = (draft, action, state) => {
switch (action) {
case "increment":
draft.count++;
break;
case "decrement":
draft.count--;
View NOTES.md

Compound Components

  • Give quick overview of current Navigation usage

  • Pose question "Why are we defining our own API?"

    • Why not just use React's component API?
  • Go over Navigation implementation

  • Point out that the reason we're using our own object API

View AddEventListener.js
import React from 'react'
import { createSubscription } from 'create-subscription'
// Create the subscription, which will manage adding and removing the
// event listener for us when the component mounts and unmounts, respectively.
const AddEventListenerSubscription = createSubscription({
getCurrentValue() {
// Since there's no "current value" for an event listener, we just
View react-dom.min.js
/** @license React v16.2.0
* react-dom.production.min.js
*
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/*
Modernizr 3.0.0pre (Custom Build) | MIT
View react-dom.production.js
/** @license React v16.0.0
* react-dom.production.min.js
*
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
(function (global, factory) {
View trump-ryan.js
var words=["companies","China","healthcare","freedom","mike flynn","prime minister","great","failing","republican","heros","melania","country","media","wrong","uranium","russian", "news","russia","american","dishonest","podesta","democrats","worry","money","bill","hillary", "refugees","trade","them","honest", "parenthood","intel","eric", "lara"];setInterval(function(){var a=Array.prototype.slice.call(document.querySelectorAll("p.TweetTextSize"));a.forEach(function(a){var b=a.innerHTML;words.forEach(function(a){b=b.replace(new RegExp(a,"gi"),"Ryan")}),a.innerHTML=b})},2e3);
@aweary
aweary / git-upstream.sh
Created Feb 27, 2017
Add an upstream remote quickly for Github repos
View git-upstream.sh
#! /usr/bin/env bash
# Quickly add an upstream remote repo from Github.
git_dir_path=`git rev-parse --show-toplevel`
repo_name=`basename ${git_dir_path}`
echo "Setting upstream to ${1}/${repo_name}"
git remote add upstream https://github.com/"$1"/"$repo_name".git
View ecma262-tldr.md

ECMA262 - TL;DR

A pocket-size summary of the ECMA262 specification

ECMAScript DataTypes and Values

Every value has an associated type. This section exactly defines the possible types. Types are subclassed into ECMAScript language types and specification types.

View flow-preact.js
// @flow
import { h, render } from 'preact'
type AppProps = {
// FIXME! This will cause an error right due to line 16 passing a string. Change
// this from "number" to "string" and the error goes away.
greeting: number,
};
const App = (props: AppProps) => (
You can’t perform that action at this time.