Skip to content

Instantly share code, notes, and snippets.

Avatar

Ville Immonen fson

View GitHub Profile
@fson
fson / benchmark.js
Last active Apr 9, 2021
spawn-benchmark
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() {
console.time("execSync");
const output = childProcess.execSync("xcodebuild -version").toString();
@fson
fson / index.js
Last active Jun 2, 2020
terminal-link-repro
View index.js
#!/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");
View gist:0c6c21f38d7af09ee76485cb1a788fa4
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
CSS in JS wish list
View css-in-js-wish-list.md
  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 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
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(`https://api.github.com/repos/${name}`).then((response) =>
@fson
fson / README.md
Created Aug 27, 2016
react-modal and Jest snapshot testing
@fson
fson / .babelrc
Created Jun 22, 2016
A todo app example with frzr and JSX.
View .babelrc
{
"plugins": [
"syntax-jsx",
["transform-react-jsx", { "pragma": "frzr.el" }]
],
"presets": ["es2015"]
}
@fson
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
fson / example.js
Created Mar 17, 2016
Recursive GraphQL demo
View example.js
import { inspect } from 'util';
import {
graphql,
GraphQLEnumType,
GraphQLID,
GraphQLInterfaceType,
GraphQLObjectType,
GraphQLList,
GraphQLNonNull,
GraphQLSchema,