Skip to content

Instantly share code, notes, and snippets.

Angular2 + JSPM cheat sheet

First time setup

  • install jspm beta: npm install -g jspm@beta
  • set up your project: jspm init
  • install dependencies: jspm install angular2 reflect-metadata zone.js es6-shim

This will create a jspm_packages folder, and a config.js file.

Open the config.js file - this file manages options for the System.js loader - tweak it as appropriate

@Integralist
Integralist / 0. description.md
Last active June 17, 2023 21:49
Clojure deftype, defrecord, defprotocol
  • defprotocol: defines an interface
  • deftype: create a bare-bones object which implements a protocol
  • defrecord: creates an immutable persistent map which implements a protocol

Typically you'll use defrecord (or even a basic map);
unless you need some specific Java inter-op,
where by you'll want to use deftype instead.

Note: defprotocol allows you to add new abstractions in a clean way Rather than (like OOP) having polymorphism on the class itself,

@john2x
john2x / 00_destructuring.md
Last active April 23, 2024 13:18
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

# strip out iBooks citation
sed -E -e 's/^[ ]?[0-9]* //g' | sed -E -e 's/“[ ]?[0-9]?[ ]?//g' | sed -E -e 's/”$//g' | sed -E -e 's/^(Excerpt From).*//g'
@michiakig
michiakig / ants.clj
Created July 19, 2011 22:37
Clojure ant sim from Rich Hickey
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;dimensions of square world