Skip to content

Instantly share code, notes, and snippets.

View branneman's full-sized avatar

Bran van der Meer branneman

View GitHub Profile
@branneman
branneman / vscode-settings.md
Last active October 9, 2018 08:05
Visual Studio Code: My setup

Visual Studio Code: My setup (macOS)

Global settings

git clone git@github.com:branneman/dotfiles.git ~/.dotfiles
ln -s ~/.dotfiles/vscode-settings.json "~/Library/Application Support/Code/User/settings.json"

Run from terminal

  • Open the Command Palette ( + + P)
/**
* @module GTMEventTracking
* @example
* <a
* data-module="event-tracking/GTMEventTracking"
* data-payload='{"event":"EventOpenGoogle"}'
* href="https://google.com/" target="_blank">
* Click me
* </a>
*/
@branneman
branneman / primitive-reference-types-javascript.md
Last active April 13, 2024 05:10
Primitive Types & Reference Types in JavaScript

Primitive Types & Reference Types in JavaScript

An explanation of JavaScript's pass-by-value, which is unlike pass-by-reference from other languages.

Facts

  • JavaScript has 2 kinds of variable types: primitive and reference.
  • A fixed amount of memory is reserved after creation of every variable.
  • When a variable is copied, it's in-memory value is copied.
  • Passing a variable to a function via a call also creates a copy of that variable.

Primitive Types

@branneman
branneman / fp-lenses.js
Last active May 17, 2023 00:56
JavaScript: Lenses (Functional Programming)
// FP Lenses
const lens = get => set => ({ get, set });
const view = lens => obj => lens.get(obj);
const set = lens => val => obj => lens.set(val)(obj);
const over = lens => fn => obj => set(lens)(fn(view(lens)(obj)))(obj);
const lensProp = key => lens(prop(key))(assoc(key));
@branneman
branneman / howto.md
Last active October 1, 2017 16:16
macOS: Manage Multiple versions of Java

macOS: Manage Multiple versions of Java

Setup tooling

brew update
brew install jenv
brew tap caskroom/cask
brew tap caskroom/versions
mkdir ~/.jenv/versions
@branneman
branneman / create-zip.js
Last active July 30, 2021 20:59
Node.js script to create a zip file from a list of files and directories
const stat = require('fs').statSync;
const AdmZip = require('adm-zip');
/**
* Example usage
*/
newArchive(`test-${+new Date}.zip`, [
'index.js',
'package.json',
'node_modules'
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Homepage</title>
<!-- If HTTP/1: Inline with <style>, remove this <link> -->
<!-- If HTTP/2: Server push this CSS file, and leave this <link> -->
<link rel="stylesheet" href="critical-homepage.css">