Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Schreiner chrisschreiner

  • Schpaencoder
  • Oslo, Norway, Europe
View GitHub Profile
@chrisschreiner
chrisschreiner / Main.elm
Created Jun 8, 2016 — forked from pdamoc/Main.elm
Req msg with cache
View Main.elm
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
View Untitled-1
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 — forked from zemm/.gitignore
Creative Commons license chooser widget in Elm
View gist:eb1b36c86dd89029aa779400a824d4ad
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({
View wonder.elm
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
View request.elm
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
View test.elm
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 Jun 25, 2018
Astronomy Picture of the Day with ReactiveCocoa 4
View APOD.swift
// 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
View gist:d820d7c5cc4a76e20fff
// 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.)
View GistServiceSpec.swift
//
// GistServiceSpec.swift
// XXXX
//
// Created by Chris Patrick Schreiner on 09/08/15.
// Copyright © 2015 Chris Patrick Schreiner. All rights reserved.
//
import Foundation
import Quick
You can’t perform that action at this time.