Skip to content

Instantly share code, notes, and snippets.

Jamie Kyle jamiebuilds

Block or report user

Report or block jamiebuilds

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 example.md
/my-website/
  package.json
  /src/
    /pages/
      index.html
      about.html
    /assets/
      site.css
      site.js
View symbols.md

Symbols

Syntax

let obj = {
  [Symbol('foo')]: 'hello!',
};

class Obj {
View Cart.js
// @flow
import React from 'react';
import { Container, Subscribe } from 'unstated';
function formatPrice(price: number) {
return `$${Math.round(price * 100) / 100} USD`;
}
class CartItem {
constructor(name: string, price: number) {
View code-owners-extension.md

[CODEOWNERS] Extension

*                 @defunkt
*.js              @octocat @github/js   min=2
docs/*            docs@example.com      review=optional min=0
CODEOWNERS        it@example.com        review=required

[block]
  *               @defunkt
View stylable-components.md

stylable-components

CSS for Components

Example

/* Counter.css */
@import Button from './Button.css';
View namespaces.md

Namespaces

Note: This borrows a lot from TypeScript.

Basic

Input

namespace MyNamespace {
View proposal-sync-module-inspection.md

Synchronous module inspection

This document describes the challenges presented by import() and how they could be addressed.

Problem

If you're starting up an app with multiple modules already loaded, using import() prevents you from gaining access to them synchronously.

View bundle-package.md

Package source:

// math-pkg/src/index.js
export pow from './pow';
export square from './square';

// math-pkg/src/pow.js
export default function pow(x, n) {
  return Math.pow(x, n);
View import-inspector-flush.js
import {inspect} from 'import-inspector';
const imported = [];
// setup a watcher
let stopInspecting = inspect(metadata => {
imported.push(metadata);
});
function flush() {
View extracting-values-in-comments.js
// @flow
function getOptions() {
return { num: 42, str: "val" };
// ^ Type of this return is inferred without type annotation.
}
/*::
// ^ Comments like this are part of Flow's Comment Syntax.
// They allow you to include any additional syntax and Flow will parse it
You can’t perform that action at this time.