Skip to content

Instantly share code, notes, and snippets.

Bran van der Meer branneman

Block or report user

Report or block branneman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@branneman
branneman / vscode-settings.md
Last active Oct 9, 2018
Visual Studio Code: My setup
View vscode-settings.md

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)
View GTMEventTracking.js
/**
* @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 Jun 15, 2019
Primitive Types & Reference Types in JavaScript
View primitive-reference-types-javascript.md

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 Apr 3, 2019
JavaScript: Lenses (Functional Programming)
View fp-lenses.js
// 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));
View Carousel.js
@branneman
branneman / howto.md
Last active Oct 1, 2017
macOS: Manage Multiple versions of Java
View howto.md

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 Apr 23, 2019
Node.js script to create a zip file from a list of files and directories
View create-zip.js
const stat = require('fs').statSync;
const AdmZip = require('adm-zip');
/**
* Example usage
*/
newArchive(`test-${+new Date}.zip`, [
'index.js',
'package.json',
'node_modules'
View a-page.html
<!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">
You can’t perform that action at this time.