Skip to content

Instantly share code, notes, and snippets.

View mheiber's full-sized avatar

Max Heiber mheiber

View GitHub Profile
let list = [1, 2]
list = list.concat(3)
console.log(list) // [1, 2, 3]
@mheiber
mheiber / bad.js
Last active February 22, 2016 01:45
let whatAmI = document.body
whatAmI = [1, 2, 3]
@mheiber
mheiber / jscore.md
Last active January 31, 2024 17:42
Using JavaScriptCore in a Production iOS app

OUTDATED

JavaScriptCore is a built-in iOS library that enables you to use JavaScript in apps alongside Objective-C and Swift. It lets developers read JavaScript from a string, execute it from Objective-C or Swift, and share data structures and functions across languages. We JavaScriptCore to share code between Web and iOS.

@mheiber
mheiber / minimal-behavior.vue
Created May 9, 2017 17:17
Minimal Behavior
<style lang="sass">
</style>
<template>
<input
class="input-text"
@input="update"
:placeholder="args.placeholder"
:value="value"
@mheiber
mheiber / link-me.sh
Created October 5, 2017 13:55
run this in the redux repo like this: ./link-me.sh dependency version-number. Example: ./link-me.sh clay-kiln 3.11.0
@mheiber
mheiber / link-me.sh
Last active October 5, 2017 13:56
run this in the redux repo like this: ./link-me.sh dependency version-number. Example: ./link-me.sh clay-kiln 3.11.0
@mheiber
mheiber / Architecture 1.js
Created January 13, 2018 03:38 — forked from anonymous/Architecture 1.js
Architecture 1.js
// Architecture 1
function callApi(x, y, z) {
manipulate params
manipulate params some more ...
return fetch(...)
.then(result => {
if (result.status === ...) {
handle status stuff
}
// Architecture 2
function callApi(x, y, z) {
const request = buildRequest(x, y, z)
return fetch(request)
.then(assertStatus('callApi', x, y, z))
.then(parseResponse)
**Diagram 1: Types of Code**

                       high
                       ^                ||
                       ^                ||
                       ^ boring I/O     ||  interesting I/O
                       ^                ||
cost of testing        ^ ================================
 ^ ||
**Diagram 2: Should I unit test?**

                       high
                       ^                ||
                       ^                ||
                       ^  don't test    ||  maybe test
                       ^                ||
cost of testing        ^ ================================
 ^ ||