This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>Live Face Detector</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style> | |
.error-msg { |
This file contains hidden or 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 { | |
withStateHandlers, | |
} = Recompose; | |
console.clear(); | |
const CANVAS_WIDTH = 640; | |
const CANVAS_HEIGHT = 480; | |
const CIRCLE_RADIUS = 48; |
This file contains hidden or 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
html{ | |
background:url("moon.jpg") no-repeat 100% 1em, | |
url("stars.jpg") repeat-x 0 0, | |
url("city.png") repeat-x bottom, | |
linear-gradient(black,#444); | |
background-color:#222; | |
min-height:100%; | |
} |
This file contains hidden or 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 * as R from 'ramda' | |
const initialState = { | |
user: { | |
name: 'jack', | |
token: 111111 | |
}, | |
goods: { | |
slug: 1, |
This file contains hidden or 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 initialState = { | |
user: { | |
name: 'anonymous', | |
token: null | |
} | |
} | |
const getUser = state => state.user || {} | |
const isAuthenticated = state => Boolean(getUser(state).token) | |
const isAnonymous = state => !isAuthenticated(user) |
This file contains hidden or 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
any | |
void | |
boolean | |
number | |
string | |
null | |
undefined |
This file contains hidden or 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
#!/usr/bin/env bash | |
# Browse Ramda documentation in Terminal | |
# Requires jq and a tool such as fzf or peco for interactive filtering | |
LATEST="http://raine.github.io/ramda-json-docs/latest.json" | |
DOCS_URL="http://ramdajs.com/docs/" | |
json=$(curl -s $LATEST) | |
functions=$(echo "$json" | jq -r '.[] | if .sig and (.sig | length > 0) then .name + " :: " + .sig else .name end') |
This file contains hidden or 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 Input = rc.compose( | |
- rc.withProps({component: "input", type: "text"}), | |
- rc.componentFromProp, | |
+ rc.componentFromProp, | |
+ rc.withProps({component: "input", type: "text"}), | |
)("component") |
This file contains hidden or 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 { ChildProps } from "react-apollo"; | |
const withCharacter = graphql<Response, InputProps>(HERO_QUERY, { | |
options: ({ episode }) => ({ | |
variables: { episode } | |
}) | |
}); | |
class Character extends React.Component<ChildProps<InputProps, Response>, {}> { | |
render(){ |
This file contains hidden or 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
+ // @flow | |
import React from "react"; | |
import gql from "graphql-tag"; | |
import { graphql } from "react-apollo"; | |
+ import type { OperationComponent } from "react-apollo"; | |
export const HERO_QUERY = gql` | |
query GetCharacter($episode: Episode!) { | |
hero(episode: $episode) { | |
name | |
id |