Skip to content

Instantly share code, notes, and snippets.

View chollier's full-sized avatar

Loic CHOLLIER chollier

View GitHub Profile
type Avatar {
# The original avatar URL
originalUrl: String @fake(type:avatarUrl, options: { imageCategory: people })
# The thumbnail resized to 64x64px
- thumbnail64Url: String @fake(type:imageUrl, options: { imageWidth: 64, imageHeight: 64, randomizeImageUrl: true })
+ thumbnail64Url: String @examples(values: ["http://example.com/image.jpg", "http://example.com/image2.jpg"])
}
loic@Loics-MacBook-Pro-32  ~/persistgraphql   master  npm run compile
> persistgraphql@0.3.1 compile /Users/loic/persistgraphql
> tsc
node_modules/@types/isomorphic-fetch/index.d.ts(23,14): error TS2300: Duplicate identifier 'BodyInit'.
node_modules/@types/isomorphic-fetch/index.d.ts(24,14): error TS2300: Duplicate identifier 'RequestInfo'.
node_modules/@types/isomorphic-fetch/index.d.ts(28,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'headers' must be of type 'any', but here has type 'string[] | Headers| { [index: string]: string; }'.
node_modules/@types/isomorphic-fetch/index.d.ts(30,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'mode' must be of type 'string', but here has type 'string | RequestMode'.
node_modules/@types/isomorphic-fetch/index.d.ts(31,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'credentials' must be of type 'string', but here has type 'string | RequestCredential
# Save dyno formation state
heroku ps:scale > mydynoformation
# Scale dynos to 0
heroku ps:scale $(heroku ps:scale | sed -E 's/=([0-9]+):/=0:/g')
# Scale dynos back to their original state
heroku ps:scale `cat mydynoformation`
@chollier
chollier / pre-commit eslint
Last active February 25, 2016 23:18
Pre-commit ESLINT hook using npm's binary
#!/bin/sh
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".js\{0,1\}$")
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
PASS=true
@chollier
chollier / gist:0a7c8365ff904b634b0f
Created March 26, 2015 19:14
TipsCalculator React Native
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @providesModule TipsCalculatorApp
* @flow
*/
'use strict';
var React = require('react-native');
var {
@chollier
chollier / gist:f53afc91544cff3c1e51
Created January 29, 2015 22:28
Immutable.js sorting
myMap is something like "OrderedMap { 3636: Map { stop: "2015-01-29T22:00:00.000-08:00", }, 3637: Map { stop: "2015-01-31T22:00:00.000-08:00", ... } }"
myMap.sort(function(a, b) {
if (moment(a.get('stop_at')).unix() > moment(b.get('stop_at')).unix()) {
return 1;
} else if (moment(a.get('stop_at')).toDate() < moment(b.get('stop_at')).toDate()) {
return -1;
} else {
return 0;
}
# Dans app.coffee :
# du coup tu peux push des custom la dedans
validators = require('react-form-builder').Validators
_.each validators, (value, key) ->
window.validators[key] = new value()
# form definition
{
@chollier
chollier / gist:97e79d85d855fbf460c0
Created July 31, 2014 19:31
setState callback not called
loadResource: (stateName, callback) ->
@abortRequest(stateName)
console.log "c"
@setState loading: true, =>
console.log "log here"
@QQAdmin.module "Entities", (Entities, App, Backbone, Marionette, $, _) ->
class Entities.Person extends Entities.Model
@chollier
chollier / jquery.borders.js
Created March 11, 2013 21:51
jQuery Borders plugins
/*!
* jQuery lightweight plugin boilerplate
* Original author: @ajpiano
* Further changes, comments: @addyosmani
* Licensed under the MIT license
*/
;(function ( $, window, document, undefined ) {