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 / 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;
}
@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
@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 ) {
def subproduct?
!self.parent.blank?
end
def self.not_sub
returning [] do |value|
Product.each do |x|
if !x.subproduct?
value << x
end
rake aborted!rake aborted!
uninitialized constant Bundler
uninitialized constant Bundler
/home/loic/repos/plusandmore/releases/20100919162044/Rakefile:4/home/loic/repos/plusandmore/releases/20100919162044/Rakefile:4
(See full trace by running task with --trace)(See full trace by running task with --trace)
uninitialized constant Bundler
uninitialized constant Bundler
/home/loic/xxxx/releases/20100919162044/Rakefile:4
/home/loic/xxxx/releases/20100919162044/Rakefile:4(See full trace by running task with --trace)