Skip to content

Instantly share code, notes, and snippets.

@anthonyshort
anthonyshort / people.json
Created February 17, 2022 22:20
People List
[
{
"id": "38016cdf-03fe-4a3b-a9df-8411bf43876c",
"firstName": "Orren",
"lastName": "Priest",
"email": "[email protected]",
"photo": "https://robohash.org/repudiandaeaeligendi.png?size=50x50&set=set1",
"department": "Support"
},
{
@anthonyshort
anthonyshort / machine.js
Last active September 25, 2020 22:16
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@anthonyshort
anthonyshort / Component.tsx
Last active February 16, 2019 16:04
React hooks + Apollo client
import useQuery from './useQuery'
import gql from 'graphql-tag'
type Props = {
projectId: string
}
export default function Project(props: Props) {
const { data, loading } = useQuery({
query: gql`
badge(options, song => {
// {
// "icon": 'https://developers.soundcloud.com/assets/logo_black.png',
// "image_url": "user or artwork url",
// "song_title": "Hello",
// "song_url": "x",
// "artist_name": "x",
// "artist_url": "x",
// "stream_url": "http://soundcloud.com/song/x?client_id=1212212"
// }
var MyButton = {
defaultProps: {
color: 'red'
},
render: function () {
return {
type: 'button'
}
}
}
let propTypes = {
'hello': { type: 'string' }
}
let ref = function (name) {
return e => e.target.ref === name
}
let eventType = function (name) {
const Parent = {
render (component, updateState) {
function onChange () {
updateState({ parentChanged: 'yay' })
}
return <Child onChange={onChange} />
}
}
@anthonyshort
anthonyshort / index.js
Last active August 29, 2015 14:22 — forked from marklundin/index.js
requirebin sketch
var deku = require( 'deku' );
// Create a component
var HelloWorld = {
render: function(c) {
return deku.element( 'div', {}, [c.props.text] );
}
}
// Create a tree
import styles from './styles.css'
export default ({props,state}) => {
<div>
<style scoped>{styles}</style>
<h1>Hello World</h1>
</div>
}