Skip to content

Instantly share code, notes, and snippets.

View gilesbradshaw's full-sized avatar
🕶️
riding my bicycle

Giles gilesbradshaw

🕶️
riding my bicycle
  • SiGyl
  • Devon
View GitHub Profile
// map with selectMany
function map(func) {
return this::selectMany(x => [func(x)]);
}
function selectMany(func) {
return this.reduce(
(acc, val) => [
...acc,
...func(val),
],
[],
);
}
it('observes a tree', marbles((m) => {
const a = {
children: [
{
children: [
{
name: 'esau',
},
{
name: 'jacob',
import merge from 'lodash/merge';
/* eslint-env mocha */
describe('new test', () => {
it('works', () => {
const getIt = (x = {}) => {
const {
a = null,
b: {
@gilesbradshaw
gilesbradshaw / Dockerfile.slack
Created March 2, 2017 20:36 — forked from alexellis/Dockerfile.slack
Slack Dockerfile for 2.1.0
FROM debian:stretch
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
RUN apt-get update && apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gconf2 \
@gilesbradshaw
gilesbradshaw / tag dependency
Last active February 25, 2016 15:01
Setting one opc tag fom another
/* configuration..
<config updateRate="1000">
<ua endpoint="opc.tcp://localhost:49320/" />
<da endpoint="localhost" server="Kepware.KEPServerEX.V5" />
<dependencies>
<dependency name="dep1">
<from node="OPC.Tag1"/>
<to node ="OPC.Tag2"/>
</dependency>
.if-xs, .if-not-sm, .if-not-md, .if-not-lg {
display:inherit;
}
.if-not-xs, .if-sm, .if-md, .if-lg {
display:none;
}
@media (min-width: 48em) {
.if-xs, .if-not-sm {
display:none;
module Lab5 where
import Control.Monad
data Concurrent a = Concurrent ((a -> Action) -> Action)
instance Functor Concurrent where
fmap = liftM
instance Applicative Concurrent where
primes :: [Int]
primes = sieve [2..]
sieve :: [Int] -> [Int]
sieve (p:xs) = p : sieve [x | x <- xs, x `mod` p /=0]
@gilesbradshaw
gilesbradshaw / arithmetic parser
Last active November 28, 2015 02:21
arithmetic parse (and other stuff) eval "(1+2)*3+4"
-- from hutton
import Control.Applicative -- Otherwise you can't do the Applicative instance.
import Control.Monad (liftM, ap)
import Data.Char
newtype Parser a = P(String -> [(a, String)])