Skip to content

Instantly share code, notes, and snippets.

Avatar
☀️
burning alive in Texas

Brandon Dail aweary

☀️
burning alive in Texas
View GitHub Profile
View typecheck.rs
use crate::type_context::{Element, TypeContext};
use ::common::unique_name::UniqueName;
use ::hir::{
hir, BinOp, Binding, Expr, ExprKind, Lit, LitKind, Local, StatementKind,
Type as HIRType, UnOp,
};
use ::hir::visit::{walk_component, walk_function, Visitor};
use data_structures::HashMap;
use diagnostics::ParseResult as Result;
View pr.sh
#!/bin/bash
set -e
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ "$BRANCH" = 'master' ]
then
echo You must check out a feature branch first
exit 1
fi
View gist:7ad7998adfb6ead94a891a0e7d12f8cf
// Option is a simple example of an enum
// that is generic, with a variant that doesn't
// use that generic type. (None)
enum Option<T> {
Some(T),
None,
}
// Two functions that take different types of `Option`s
fn with_option_string(input: Option<string>) {}
View gist:fcea42ec750eb1f26164c120e77f20c5
function signPage() {
document.querySelectorAll("a[id^=sig]").forEach((node) => {
node.click();
});
setTimeout(() => {
document.querySelector('[data-bb-handler="sign"]').click();
setTimeout(() => {
document.querySelector(".goto_next_page").click();
}, 100);
}, 100);
View for_expr.rs
fn for_expr(&mut self) -> Result<ast::Expr> {
self.expect(TokenKind::Reserved(Keyword::For))?;
let lo = self.span;
let pattern = self.local_pattern()?;
self.expect(TokenKind::Reserved(Keyword::In))?;
let expr = self.expr(Precedence::NONE)?;
let block = self.block()?;
let span = lo.merge(self.span);
Ok(ast::Expr {
id: DUMMY_NODE_ID,
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