Skip to content

Instantly share code, notes, and snippets.


Ville Immonen fson

View GitHub Profile
fson / benchmark.js
Last active Apr 9, 2021
View benchmark.js
#!/usr/bin/env node
const spawnAsync = require("@expo/spawn-async");
const assert = require("assert");
const childProcess = require("child_process");
const crossSpawn = require("cross-spawn");
function profileExecSync() {
const output = childProcess.execSync("xcodebuild -version").toString();
fson / index.js
Last active Jun 2, 2020
View index.js
#!/usr/bin/env node
const terminalLink = require('terminal-link');
console.log('# Link');
console.log(terminalLink("I'm a link, click me.", ''));
console.log('# URL:');
console.log("Here's a URL:");
View gist:0c6c21f38d7af09ee76485cb1a788fa4
Verifying my Blockstack ID is secured with the address 1FborCiWomnCbAfgVb5sdvUB3tM5jdpWJk
fson /
Last active May 23, 2017
CSS in JS wish list
  1. Style elements inline in JSX via the style prop, without any wrapping. No (mandatory) "presentational components" or StyleSheet.
  • style prop allows for compatibility with react-primitives, React Native components and many 3rd party components. The Primitives (View, Text, Image...) are designed to work cross-platform (web, Android, iOS...) and they provide convenient defaults for Flexbox based layout.
  • I want to add these elements in JSX, style them inline and only name and extract them to separate component when it becomes necessary, not upfront. Extracting to a named component can be as simple as adding const Wrapper = () => before the JSX element. No new syntax for creating a component.
  1. Support vendor prefixes, pseudo classes, media queries, CSS variables...
  • Support things like @media (-webkit-min-device-pixel-ratio: 2), :hover, or `var(--panel-back
fson / paluu.js
Last active Apr 3, 2017
Paluu.js – Redux
View paluu.js
tuo onPelkistettyOlio paikasta 'ala-ajatusviiva/onPelkistettyOlio'
tuo $$havaittava paikasta 'merkki-havaittava'
vie vakio TekoTyypit = {
ALUSTA: '@@redux/ALUSTA'
vie oletus funktio luoVarasto(vähentäjä, esikuormitettuTila, tehostaja) {
jos (
sentyyppi esikuormitettuTila === 'funktio' &&
fson / promiseErrorHandling.js
Last active Sep 18, 2016
Promise error handling with the Either pattern (disjunction)
View promiseErrorHandling.js
import { Failure, Success } from 'data.validation';
// Report unhandled promise rejections (bugs)
window.onunhandledrejection = (event) => {
// Raven.captureException(event.reason);
console.error('Unhandled rejection:', event.reason);
function fetchRepo(name) {
return fetch(`${name}`).then((response) =>
fson /
Created Aug 27, 2016
react-modal and Jest snapshot testing
fson / .babelrc
Created Jun 22, 2016
A todo app example with frzr and JSX.
View .babelrc
"plugins": [
["transform-react-jsx", { "pragma": "frzr.el" }]
"presets": ["es2015"]
fson / ReindexSchema.json5
Last active Jul 13, 2016
Reindex shopping cart schema with permissions
View ReindexSchema.json5
name: 'Shop',
kind: 'OBJECT',
interfaces: ['Node'],
fields: [
{ name: 'id', type: 'ID', nonNull: true, unique: true },
{ name: 'owner', type: 'User', reverseName: 'ownShops' },
{ name: 'staff', type: 'Connection', ofType: 'User',
reverseName: 'staffShops' },
fson / example.js
Created Mar 17, 2016
Recursive GraphQL demo
View example.js
import { inspect } from 'util';
import {