Skip to content

Instantly share code, notes, and snippets.

View chrisschreiner's full-sized avatar

Chris Schreiner chrisschreiner

  • Schpaencoder
  • Oslo, Norway, Europe
View GitHub Profile
@chrisschreiner
chrisschreiner / Main.elm
Created June 8, 2016 06:33 — forked from pdamoc/Main.elm
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
parseKeyPress : Int -> Model -> ( Model, Cmd Msg )
parseKeyPress c model =
let
f =
case parseKey c of
Key1 ->
DebugTogglePadding
KeySpace ->
MakeMagicHappen
@chrisschreiner
chrisschreiner / .gitignore
Created May 15, 2016 17:46 — forked from zemm/.gitignore
Creative Commons license chooser widget in Elm
elm-stuff
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
resolveLoader: {
root: __dirname + "/node_modules"
},
plugins: [
new webpack.ProvidePlugin({
module Main (..) where
import Maybe exposing (Maybe, withDefault)
import List exposing (head, length)
import Graphics.Collage as GC
import Graphics.Element as GE
import Graphics.Element
import Graphics.Collage exposing (rotate)
import Signal exposing (..)
import Mouse
port runner : Task Http.RawError ()
port runner = State.askForData q `Task.andThen` report
report : Http.Response -> Task x ()
report res =
Signal.send contentMailbox.address (toString res.value)
contentMailbox : Signal.Mailbox String
module Lifting (main) where
import Json.Decode as J
import Window
import Html
import Http
import Task
import Graphics.Element
import Color exposing (grayscale)
import Signal exposing(map)
@chrisschreiner
chrisschreiner / APOD.swift
Last active June 25, 2018 10:33
Astronomy Picture of the Day with ReactiveCocoa 4
// APOD.swift
// Test with ReactiveCocoa 4
//
// Created by Chris Patrick Schreiner on 17-11-2015.
import ReactiveCocoa
import Result
import XCPlayground
XCPlaygroundPage.currentPage.needsIndefiniteExecution = true
// There's some function that takes an UnsafeBufferPointer
func f(ubp: UnsafeBufferPointer<UInt8>)
...
// I want to call it with NSData
let data: NSData(...)
f(UnsafeBufferPointer(start: UnsafePointer<UInt8>(data.bytes), count: data.length))
// Would I need to NSData.withUnsafeBufferPointer() to exist? (Which of course it doesn't.)
//
// GistServiceSpec.swift
// XXXX
//
// Created by Chris Patrick Schreiner on 09/08/15.
// Copyright © 2015 Chris Patrick Schreiner. All rights reserved.
//
import Foundation
import Quick