Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View fson's full-sized avatar

Ville Immonen fson

View GitHub Profile
@fson
fson / ReindexSchema.json
Created October 29, 2015 16:43
Import data from the Movie Database into Reindex
[
{
"name": "TvSeason",
"kind": "OBJECT",
"interfaces": [
"Node"
],
"fields": [
{
"name": "air_date",
@fson
fson / rapid-prototyping-with-relay.md
Created October 18, 2015 20:08
Rapid prototyping with Relay (Reactive 2015 lightning talk proposal)

This is a proposal for a lightning talk at the Reactive 2015 conference.

NOTE: If you like this, star ⭐ the Gist - the amount of stars decides whether it makes the cut!

Rapid prototyping with Relay

Relay makes data fetching in React apps simpler, by letting you declare the data needs of your components instead of writing complex imperative code. React, Relay, GraphQL and the other complementary tools are changing how apps are built.

@fson
fson / updateSchema.js
Created August 15, 2015 22:34
Update GraphQL schema file
#!/usr/bin/env babel-node --optional es7.asyncFunctions
import fs from 'fs';
import path from 'path';
import fetch from 'isomorphic-fetch';
import { introspectionQuery } from 'graphql/utilities';
const url = 'http://localhost:5000';
@fson
fson / even.js
Created June 7, 2015 17:16
Mutually recursive modules
import odd from './odd';
export default function even(n) {
if (n === 0) {
return true;
}
return !odd(n - 1);
}
@fson
fson / timeit.js
Last active December 29, 2015 23:59
function timeit(fn) {
console.time(fn.name);
fn.apply(null, [].slice.call(arguments, 1).map(function (arg) {
if (arg === timeit.done) return function () { console.timeEnd(fn.name); }
else return arg;
}));
}
timeit.done = function () {};
@fson
fson / refactoring.md
Created December 12, 2012 19:48 — forked from anonymous/README.md
Meanings of refactoring
  • Martin Fowler: "disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior"
  • Opionated developer: renaming source files
  • Minimalistic developer: removing source files
  • Badass developer: rewriting everything from scratch
  • Technical lead: calls it 'improving' instead, to avoid scaring the management
  • Project manager: fixing previous mistakes
  • Product manager: time when no new features get done
  • CEO: slacking
@fson
fson / repl.coffee
Created October 15, 2012 18:47
REPL in CoffeeScript
loop alert eval prompt()
@fson
fson / fun.coffee
Created July 17, 2012 21:40
Obfuscated CoffeeScript
# factorial
$ = (_) ->
__ = _
--__ && _ = _ * $ __
_
# each
$$ = (_, __) ->
@fson
fson / slug.js
Created January 4, 2012 17:46 — forked from maccman/slug.js
Hem & Less
var hem = new (require('hem'));
var less = require('less');
var fs = require('fs');
var argv = process.argv.slice(2);
var path = require('path');
var util = require('util');
hem.compilers.less = function (pathname) {
var content, result;
content = fs.readFileSync(pathname, 'utf8');