Skip to content

Instantly share code, notes, and snippets.

@gampleman
gampleman / Collection.elm
Created March 30, 2018 09:44
A module that abstracts over common collection types
module Collection
exposing
( Collection
, isEmpty
, length
, head
, tail
, take
, drop
, slice
@rupertlssmith
rupertlssmith / GameState.elm
Last active July 21, 2023 01:09
Exploring State Machines with phantom types in Elm
module GameState
exposing
( Game(..)
, GameDefinition
, PlayState
, loading
, updateGameDefinition
, updatePlayState
, updateScore
, toReady
@nqthqn
nqthqn / Ports.elm
Created August 30, 2017 19:28
Porting to Js
port module Ports exposing (..)
import Json.Encode
type alias Key =
String
type alias Value =
@coreyhaines
coreyhaines / UserAlert.elm
Created January 27, 2017 22:18
User Alerts
module Shared.UserAlert exposing (UserAlert, Msg, show, startShowAlertAnimation, startHideAlertAnimation, default, update, view)
import Helpers exposing (classes)
import Shared.Animation as Animation
import Html exposing (Html, div, span, text)
import Html.Attributes exposing (class)
import Task
type UserAlert
@Sweet-Bob
Sweet-Bob / adapters-post.js
Created August 11, 2016 18:03
[Ember.js] Custom API request
import RESTAdapter from 'ember-data/adapters/rest';
export default RESTAdapter.extend({
/**
* @param {DS.Model} model
* @param {JSON} serializedCommentData
* @returns {*}
*/
postComment(model, serializedCommentData) {

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
@maxhoffmann
maxhoffmann / Main.elm
Last active February 8, 2018 23:57
Token HTTP Authentication in Elm
import Html.App as Html
import Html exposing (..)
import Html.Events exposing (..)
import Task
import Http
import Json.Decode as Json exposing ((:=))
-- Model
@gorangajic
gorangajic / es6-spread-immutable-cheatsheet.md
Last active April 11, 2024 08:32
es6 spread immutable cheatsheet

update object

var state = {
    id: 1,
    points: 100,
    name: "Goran"
};

var newState = {
@marty-wang
marty-wang / gist:5a71e9d0a6a2c6d6263c
Last active February 13, 2024 07:34
Compile and deploy React Native Android app of Release version to device.
Disclaimer: The instructions are the collective efforts from a few places online.
Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did.
First off, bundle.
==================
1. cd to the project directory
2. Start the react-native packager if not started
3. Download the bundle to the asset folder:
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
@ohanhi
ohanhi / frp.md
Last active May 6, 2024 05:17
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note