This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface Car { | |
doors: number; | |
} | |
export const Car: Car = { | |
doors: 4 | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Defines a color as a CSS custom property, along with a custom property for | |
* all of the color's component parts in both RGB and HSL. | |
* | |
* Example: | |
* | |
* :root { | |
* @include defineColor("blue", #0000ff); | |
* } | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am dandean on github. | |
* I am dandean (https://keybase.io/dandean) on keybase. | |
* I have a public key ASBxY7cqp9cbHPp4eGOlt6zX8kCdm3-y8H_bZ62sU-i5sAo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
directive @fromSourceField(name: String!) on FIELD | |
""" | |
This is a Contact type where the data source uses type-specific field names | |
for their ID fields. In this case we're renaming this field to `id` instead | |
of `contact_id`, making it much more friendly to the consuming application. | |
""" | |
type Contact { | |
id: ID! @fromSourceField(name: "contact_id") | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I haven't tested this one, but something like this should work? | |
class Component1 extends React.Component { | |
render() { | |
// Create a new `props` object without `foo` and `bar` properties | |
const { | |
...props, | |
foo, | |
bar | |
} = someComponent.props; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let i = 0; | |
class UsesConditional extends React.Component { | |
render() { | |
i++; | |
return ( | |
<div> | |
<Conditional if={i % 2}> | |
<span>Show Me</span> | |
</Conditional> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div className="pricing" style={{ opacity: purchasing ? 0.25 : '' }}> | |
<Conditional if={purchaseComplete}> | |
<div className="purchase-complete"> | |
<h2>Thanks!</h2> | |
<p> | |
Thank you for your purchase of {formatPrice(this.state.total)}. | |
We’ll send you a receipt shortly. | |
</p> | |
<p> | |
<button |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import args from "assert-args"; | |
// Annotate functions for argument warnings in non-production environments: | |
@args({ bar: String, baz: Function }) | |
function foo(bar, baz) { | |
} | |
foo(); | |
// Argument Warning: expected bar to be String, found undefined | |
// Argument Warning: expected baz to be Function, found undefined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const React = require('react'); | |
const { Link } = require('react-router'); | |
/** | |
* class ListItemLink < Router.Link | |
* | |
* Extends <Link /> to move the active class name to a wrapping <li> | |
*/ | |
export default class ListItemLink extends Link { | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var foo = Symbol('foo'); | |
class MyClass { | |
constructor() { | |
// Calling a private method!!! | |
this[foo](); | |
} | |
[foo]() { | |
alert('FOOOOOO!!!!!!'); |
NewerOlder