Skip to content

Instantly share code, notes, and snippets.

View simonh1000's full-sized avatar

Simon Hampton simonh1000

View GitHub Profile
@pdamoc
pdamoc / Main.elm
Created May 31, 2016 19:35
Req msg with cache
module Main exposing (..)
import Html exposing (..)
import Html.App as App
import Html.Events exposing (onClick)
import Req exposing (..)
import Dict exposing (Dict)
main : Program Never

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

@evancz
evancz / Architecture.md
Last active December 21, 2022 14:28
Ideas and guidelines for architecting larger applications in Elm to be modular and extensible

Architecture in Elm

This document is a collection of concepts and strategies to make large Elm projects modular and extensible.

We will start by thinking about the structure of signals in our program. Broadly speaking, your application state should live in one big foldp. You will probably merge a bunch of input signals into a single stream of updates. This sounds a bit crazy at first, but it is in the same ballpark as Om or Facebook's Flux. There are a couple major benefits to having a centralized home for your application state:

  1. There is a single source of truth. Traditional approaches force you to write a decent amount of custom and error prone code to synchronize state between many different stateful components. (The state of this widget needs to be synced with the application state, which needs to be synced with some other widget, etc.) By placing all of your state in one location, you eliminate an entire class of bugs in which two components get into inconsistent states. We also think yo
@robbestad
robbestad / limitFromTo.js
Last active December 27, 2015 07:29
Limit From-To filter for AngularJS
/**
* @name limitFromTo
* @by Sven Anders Robbestad, 2013
* @license CC0 1.0 Universal (CC0 1.0)
* @description
* Limit From-To filter for AngularJS.
* Creates a new array or string containing only a specified number of elements with an extra
* parameter specifying the starting point..
* The elements are taken from either the beginning or the end of the source array or string, as
* specified by the value and sign (positive or negative) of `limit`.