Skip to content

Instantly share code, notes, and snippets.

View scottcorgan's full-sized avatar
💭
Not coding

Scott Corgan scottcorgan

💭
Not coding
  • Tamarack
  • Shelbyville, KY
View GitHub Profile
module Writeable exposing (..)
import Html.App as App
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Json.Decode
import Json.Encode
module TextThing exposing (..)
import Html.App as App
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Dom.Scroll
import Dom.Size
import Task
@scottcorgan
scottcorgan / elm-css.sublime-snippet
Last active July 23, 2016 14:49
Sublime Text Snippet for Elm Css File
<snippet>
<content><![CDATA[
module Component.${1} exposing (CssClasses(..), css, class, classList)
import Css exposing (..)
import Css.Namespace exposing (namespace)
import Html.CssHelpers
styleNamespace : String
@scottcorgan
scottcorgan / elm-module-template-sublime-text.sublime-snippet
Last active July 6, 2016 16:27
Sublime Text snippet for an Elm module template
<snippet>
<content><![CDATA[
module ${1:ComponentName} exposing (..)
import Html exposing (..)
import Html.App
main : Program Never
main =
// Brute force way to create infinitely nested lists.
// What's a better way to model this and store in db?
[
{id: 1, parenId: null},
{id: 2, parenId: null},
{id: 3, parenId: 2},
{id: 4, parenId: 2},
{id: 5, parenId: 1},
{id: 6, parenId: 1},
let initialState = {
one: 'two',
three: 'four'
}
function update1 (state = initialState, action) {
switch (action.type) {
case SOMETHING: {
return state.one = 'changed'
// Need to dock compensation because the width is not accurate
// when dock is hidden
var HIDDEN_DOCK_COMPENSATION = 4
var halfRight = slate.operation('push', {
direction: 'right',
style: 'bar-resize:screenSizeX / 2'
})
var halfLeft = slate.operation('move', {
function main (sources) {
let {DOM} = sources
function preventDefault (e) {
e.preventDefault()
return e
}
@scottcorgan
scottcorgan / rx-and-pipe.js
Created January 19, 2016 21:25
node pipe vs rx.js
// Node streams
import through from 'through2'
function doSomethingToStream (config) {
return through((chunk, enc, next) {
next(/* do somethig here */)
})
}
test('showing flash message', ({plan, deepEqual, context}) => {
plan(2)
let {store} = context
let results = []
let unsubscribe = store.subscribe(() => results.push(store.getState().ui.flash))
store.dispatch(showFlashMessage({
message: 'message',