Skip to content

Instantly share code, notes, and snippets.

View fson's full-sized avatar

Ville Immonen fson

View GitHub Profile
@fson
fson / benchmark.js
Last active April 9, 2021 08:08
spawn-benchmark
#!/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() {
console.time("execSync");
const output = childProcess.execSync("xcodebuild -version").toString();
@fson
fson / example.js
Created March 17, 2016 15:10
Recursive GraphQL demo
import { inspect } from 'util';
import {
graphql,
GraphQLEnumType,
GraphQLID,
GraphQLInterfaceType,
GraphQLObjectType,
GraphQLList,
GraphQLNonNull,
GraphQLSchema,
@fson
fson / index.js
Last active June 2, 2020 11:29
terminal-link-repro
#!/usr/bin/env node
const terminalLink = require('terminal-link');
console.log();
console.log('# Link');
console.log(terminalLink("I'm a link, click me.", 'https://expo.fyi/manifest-url'));
console.log();
console.log('# URL:');
console.log("Here's a URL: https://expo.fyi/manifest-url");
@fson
fson / .babelrc
Created June 22, 2016 21:12
A todo app example with frzr and JSX.
{
"plugins": [
"syntax-jsx",
["transform-react-jsx", { "pragma": "frzr.el" }]
],
"presets": ["es2015"]
}
@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
Verifying my Blockstack ID is secured with the address 1FborCiWomnCbAfgVb5sdvUB3tM5jdpWJk https://explorer.blockstack.org/address/1FborCiWomnCbAfgVb5sdvUB3tM5jdpWJk
@fson
fson / css-in-js-wish-list.md
Last active May 23, 2017 12:28
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
fson / paluu.js
Last active April 3, 2017 10:58
Paluu.js – Redux
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
fson / promiseErrorHandling.js
Last active September 18, 2016 19:01
Promise error handling with the Either pattern (disjunction)
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(`https://api.github.com/repos/${name}`).then((response) =>
@fson
fson / README.md
Created August 27, 2016 10:30
react-modal and Jest snapshot testing

Gist