I hereby claim:
- I am wmertens on github.
- I am wmertens (https://keybase.io/wmertens) on keybase.
- I have a public key ASA6XQ6RqdgBgVFsOKWY0PV55O0x0hHULlbBfmNNhGbUXwo
To claim this, I am signing this object:
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>fileTypes</key> | |
<array> | |
<string>nix</string> | |
</array> | |
<key>name</key> | |
<string>Nix</string> |
# Pure coffeescript React.JS | |
# Also features "global state manager" | |
R = React.DOM | |
N = null | |
# global state manager | |
render = null | |
state = clicks: 0 | |
count = -> |
# Auto-vendor-prefixer | |
# Finds the vendor prefix to use | |
# MIT license, Author: Wout Mertens | |
prefix=null | |
myStyle=document?.head?.style or {} | |
foundProps={} | |
newCssProp = (prop) -> | |
t = foundProps[prop] |
# We have a function that loads some resource. It might get called multiple times by our application, for example a web server. | |
# We use a stored promise to serve as both a cache and a hook for multiple callers to get the same result | |
# JavaScript version at the bottom | |
Q = require 'q' | |
loadPromise = null | |
doLoad = -> | |
if not loadPromise | |
# get a fresh result | |
loadPromise = Q.delay(1000).then -> Date.now() | |
# after 1 second clear cache |
on run | |
-- Figure out if we want to do the cd (doIt) | |
-- Figure out what the path is and quote it (myPath) | |
set doIt to false | |
try | |
tell application "Finder" to set doIt to frontmost | |
set myPath to finder_path() | |
if myPath is equal to "" then | |
set doIt to false | |
else |
// Based on https://gist.github.com/langpavel/b30f3d507a47713b0c6e89016e4e9eb7 | |
const serializeDate = value => { | |
if (value instanceof Date) { | |
return value.toJSON().slice(0, 10) | |
} else if (typeof value === 'number') { | |
return Math.trunc(value) | |
} else if (typeof value === 'string') { | |
return (new Date(value)).toJSON().slice(0, 10) | |
} | |
return null |
I hereby claim:
To claim this, I am signing this object:
enum PostStates { DRAFT, PUBLISHED, ARCHIVED } | |
scalar Date | |
scalar Html | |
directive @buildIndex on field | |
directive @defaultFirst on field | |
#...etc | |
type PostContent { | |
brief: Html @editor(height: 150, wysiwyg: true) | |
extended: Html @editor(height: 400, wysiwyg: true) |
import React, {Component, PropTypes} from 'react' | |
import {Link, Route as OrigRoute, Switch, Redirect, BrowserRouter as Router, withRouter} from 'react-router-dom' | |
// Subscribes a child to history updates, passing the current location as a prop | |
// This is needed to work around the React context API not updating all children | |
// See https://github.com/ReactTraining/react-router/issues/4629#issuecomment-284218493 | |
export class LocationListener extends Component { | |
static contextTypes = { | |
history: PropTypes.object, | |
} |
import DataLoader from 'dataloader' | |
import {graphqlExpress} from 'graphql-server-express' | |
import schema from './schema' | |
import db from './database' | |
const contextFromReq = req => { | |
const {session} = req | |
const loaders = {} | |
const getLoader = (id, makeGetter) => { |