Skip to content

Instantly share code, notes, and snippets.

View seanstrom's full-sized avatar
:octocat:

Sean Hagstrom seanstrom

:octocat:
View GitHub Profile
[1/1 TypesDoNotUnify] src/Main.purs:20:16
v
20 config state = do
21 -- | Create a signal of URL changes.
22 urlSignal <- sampleUrl
...
29 , update: update
30 , view: view
31 , inputs: [routeSignal] }
boot.kernelPackages = pkgs.linuxPackags_4_2;
boot.initrd.luks.devices = [
{ name = "rootfs";
device = "/dev/sda3";
preLVM = true; }
];
networking.hostName = "sn-m3800-nixos";
networking.networkmanager.enable = true;
i18n = {
@seanstrom
seanstrom / example.purs
Created September 7, 2015 00:47
Array Pattern Matching
module Main where
import Prelude
import Data.Maybe
import Data.Array
import Data.Either
import Data.Foreign
import Node.Yargs
@seanstrom
seanstrom / identity.ls
Created May 31, 2015 01:59
identity function livescript
identity = (x) -> x
@seanstrom
seanstrom / example.js
Last active August 29, 2015 14:13
Async JS/Node - Promises Always Async Output
var endpoint = 'my/endpoint'
var dataPromise = getData(endpoint)
console.log(1)
dataPromise.then(function(data) {
console.log(2)
})
console.log(3)
@seanstrom
seanstrom / example.js
Created January 20, 2015 22:24
Async JS/Node - Callbacks Not Alway Async Output - Sync
var endpoint = 'my/endpoint'
console.log(1)
getData(endpoint, function(err, data) {
console.log(2)
})
console.log(3)
@seanstrom
seanstrom / example.js
Last active August 29, 2015 14:13
Async JS/Node - Callbacks Not Alway Async Output - Async
var endpoint = 'my/endpoint'
console.log(1)
getData(endpoint, function(err, data) {
console.log(2)
})
console.log(3)
@seanstrom
seanstrom / example.js
Created January 20, 2015 19:24
Async JS/Node - Sequential Promises Example - Part 2
// Part 2
var username = 'seanghagstrom'
findLikesForPostsByUsername(username)
.then(function(totalLikes) {
console.log(username + ' total number of likes: ' + totalLikes)
})
.catch(function(err) {
console.error(err)
@seanstrom
seanstrom / example.js
Last active August 29, 2015 14:13
Async JS/Node - Sequential Promises Example - Part 1
// Part 1
function findLikesForPostsByUsername(username, callback) {
var promise = new Promise(function(resolver, rejector) {
findUserByUsername(username)
.then(findPostsByUser)
.then(findLikesByPosts)
.then(function(likes) {
var totalLikes = likes.reduce(function(x, y) { return x + y })
resolver(totalLikes)
@seanstrom
seanstrom / example.js
Last active August 29, 2015 14:13
Async JS/Node - Using Promise Example
var endpoint = 'my/endpoint'
var dataPromise = getData(endpoint)
dataPromise.then(function(data) {
console.log(data)
}, function(error) {
console.error(error)
})