Skip to content

Instantly share code, notes, and snippets.

View arecvlohe's full-sized avatar
🚫
End ASF Mascotry / Drop ICE

Adam Recvlohe arecvlohe

🚫
End ASF Mascotry / Drop ICE
View GitHub Profile
@arecvlohe
arecvlohe / inverseCaptcha.re
Last active February 7, 2018 15:41
Advent of Code - Day 1
let inverseCaptcha = (path) => {
let arr =
Node_fs.readFileSync(path, `utf8)
|> Js.String.trim
|> Js.String.split("");
Js.Array.reducei(
(acc, curr, idx) =>
switch (idx == 0) {
| true =>
let firstValue = int_of_string(curr);
@arecvlohe
arecvlohe / react-redux-union.js
Last active September 3, 2017 19:22
An async example of using union-type
import Type from "union-type";
import { createStore, combineReducers } from "redux";
import memoize from "ramda/src/memoize";
import path from "ramda/src/path";
import axios from "axios";
import Future from "fluture";
// MESSAGES
const Msg = Type({
@arecvlohe
arecvlohe / store.js
Last active September 2, 2017 15:57
A simpler Redux boilerplate
import { combineReducers, createStore } from "redux";
import Type from "union-type";
// MESSAGES
const Msg = Type({ INCREMENT: [], DECREMENT: [], DEFAULT: [] });
// UPDATE
const nextState = Msg.caseOn({
function flatten(array) {
return array.reduce((acc, curr) => {
if (Array.isArray(curr)) {
return flatten([...acc, ...curr])
}
return acc.concat(curr)
}, [])
}
@arecvlohe
arecvlohe / esnextbin.md
Last active May 29, 2017 02:06
esnextbin sketch
Verifying that "adamrecvlohe.id" is my Blockstack ID. https://onename.com/adamrecvlohe
@arecvlohe
arecvlohe / Main.elm
Created May 6, 2017 03:50 — forked from anonymous/Main.elm
Elm Hex Clock
module Main exposing (..)
import Html exposing (Html, Attribute, div, text)
import Html.Attributes exposing (style)
import Time exposing (Time, every)
import List exposing (map)
import String exposing (join, length)
import Date exposing (fromTime, hour, minute, second)
@arecvlohe
arecvlohe / Main.elm
Created May 6, 2017 03:27 — forked from anonymous/Main.elm
Elm Hex Clock
module Main exposing (..)
import Html exposing (Html, Attribute, div, text)
import Html.Attributes exposing (style)
import Time exposing (Time, every, hour, minute, second, inHours, inMinutes, inSeconds)
import List exposing (map)
import String exposing (join, length)
-- STYLES
module Main exposing (..)
import Html exposing (Html, text, div, button)
import Html.Events exposing (onClick)
import Random
import Maybe exposing (withDefault)
import List.Extra exposing (getAt)
-- MODEL
init : ( Model, Cmd Msg )
init =
( { author = "Adam", quote = "Elm is a nice language to use!" }, Cmd.none )