Skip to content

Instantly share code, notes, and snippets.

View rohanorton's full-sized avatar

Rohan Orton rohanorton

  • Berlin, Germany
View GitHub Profile
optional "note" string ""
optional "note" (map Just string) Nothing
optional "note" (map (\x -> if x == "" then Nothing else Just x) string) Nothing
bang : String -> String
bang str =
str ++ “!”
uppercase : String -> String
uppercase str =
String.toUpper str
import Html exposing (div, button, text, p)
import Html.App exposing (beginnerProgram)
import Html.Events exposing (onClick, on, targetValue)
import Html.Attributes exposing (style)
import Json.Decode as Json
main =
beginnerProgram { model = init, view = view, update = update }
-- Model
import Html exposing (..)
import Html.App as Html
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Http
import Json.Decode as Json
import String exposing (..)
import Task
import StartApp.Simple exposing (start)
import Html exposing (Html, div, text)
import Html.Attributes exposing (contenteditable)
import Html.Events exposing (on, targetValue)
-- Model
type alias Model = String
init : Model
process.on('SIGINT', function () {
console.log('killed');
});
process.stdin.emit('SIGINT');
console.log('continued');
@rohanorton
rohanorton / partial.js
Last active February 26, 2016 13:29
Partial
const partial = (fn, oldArgs = []) => (...newArgs) => {
const totalNumberOfArgsRequired = fn.length;
const args = oldArgs.concat(newArgs);
const numberOfRemainingArgs = totalNumberOfArgsRequired - args.length;
return (numberOfRemainingArgs > 0) ?
partial(fn, args) :
fn(...args);
}
export default partial;
@rohanorton
rohanorton / esnextbin.md
Last active February 2, 2016 07:40
esnextbin sketch
######
# This Makefile was written to compile my attempts while studying Learn C the Hard Way
# it will look inside the src directory and compile all files ending in .c to the bin directory,
# one executable for every source file (no linking, no object files etc.)
######
## Debug CFLAGS:
CFLAGS=-Wall -g -pipe
## Non-debug CFLAGS:
#CFLAGS=-pipe -O2