Skip to content

Instantly share code, notes, and snippets.

View robinheghan's full-sized avatar

Robin Heggelund Hansen robinheghan

View GitHub Profile
@robinheghan
robinheghan / questions.md
Created June 25, 2021 10:19
Questions about JS engine fundamentals
@robinheghan
robinheghan / Util.js
Last active March 5, 2019 20:08
_Util_eq optimization
/* SETUP */
var Benchmark = require('benchmark');
function _Utils_Tuple2(x,y) {
return {
$: '#2',
a: x,
b: y
};
@robinheghan
robinheghan / Main.elm
Created January 27, 2019 10:24
Potential optimization
module Main exposing (main)
{-
So I just went over my projects at work, and my hobby project.
This gist is an example of a common way for me, and my colleagues at work, to structure progrograms:
src/Main.elm <-- Top-level model-view-update
src/VippsModal.elm <-- Popup modal, for paying with a norwegian payment solution, has its own model-view-update
src/Data/UserInfo.elm <-- The UserInfo alias, and methods for working on that data
src/Backend.elm <-- For communicating with the backend
[core]
quotepath = false
autocrlf = input
[user]
name = Robin Heggelund Hansen
email = robin.heggelund@icloud.com
[credential]
helper = osxkeychain
[push]
default = upstream
@robinheghan
robinheghan / memoisering.clj
Last active May 27, 2018 10:45
Memoisering
;; Ok. Jeg husker ikke Scheme/Racket helt, så jeg tar det i Clojure.
;; Jeg satser på at syntaxen er lik nok til at du skjønner poenget.
;; Først skal jeg bare forklare et par konsepter som kan være ulikt scheme.
;; atom
;; Alt i Clojure er i utgangspunktet immutable(ikke-muterbart).
;; Funksjoner som set-car! og set-cdr! finnes ikke.
;; For å kunne mutere state, kan en pakke inn en verdi i et atom.
;;
;; (def muterbar (atom '()) <-- definerer en muterbar liste som heter 'muterbar'
@robinheghan
robinheghan / index.js
Last active October 14, 2016 22:32
Benchmark of Elm update function
// npm install benchmark
var bench = require('benchmark');
function updateOriginal(oldRecord, updatedFields)
{
var newRecord = {};
for (var key in oldRecord)
{
newRecord[key] = (key in updatedFields) ? updatedFields[key] : oldRecord[key];
@robinheghan
robinheghan / Main.elm
Created November 26, 2015 19:08
AWS Lambda Elm
module Main where
import Signal
type alias Message =
{ operation : String
, message : String
}