Skip to content

Instantly share code, notes, and snippets.

View piq9117's full-sized avatar
๐Ÿ’€
Nothing good is happening here

piq9117 piq9117

๐Ÿ’€
Nothing good is happening here
View GitHub Profile
@piq9117
piq9117 / postgres-brew.md
Created January 27, 2018 06:48 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@piq9117
piq9117 / postgres-brew.md
Created January 27, 2018 06:48 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@piq9117
piq9117 / Haph.hs
Created January 21, 2018 05:21 — forked from rexim/Haph.hs
{-# LANGUAGE InstanceSigs #-}
module Haph (bfs) where
import qualified Data.Set as Set
import qualified Data.Map as Map
import qualified Data.List.Ordered as O
newtype AdjacencyList v = AdjacencyList (Map.Map v [v])
class Graph g where
@piq9117
piq9117 / HKT.js
Created November 21, 2017 08:55 — forked from hallettj/HKT.js
Concept for emulating higher-kinded types in Flow via type-level functions
/*
* Concept for emulating higher-kinded types using Flow. Instead of passing
* a type that has not been applied to parameters, this pattern passes
* a type-level function that will map a parameter type to the desired
* higher-kinded type applied to the given parameter.
*
* @flow
*/
// type-level function application
@piq9117
piq9117 / reader.js
Created November 9, 2017 08:41 — forked from dypsilon/reader.js
Example usage of the reader monad.
/**
* This short program will encrypt the user password
* and insert a new record into a mock database.
*/
const Reader = require('fantasy-readers');
const R = require('ramda');
const crypto = require('crypto');
// our mock database
const database = [
@piq9117
piq9117 / Lens.cs
Created September 13, 2017 06:02 — forked from tonymorris/Lens.cs
Lens library for C# (demonstration)
using System;
using System.Collections;
using System.Collections.Generic;
/*
A basic lens library for the purpose of demonstration.
Implements a lens as the costate comonad coalgebra.
This library is not complete.
A more complete lens library would take from
@piq9117
piq9117 / doyle.js
Created August 26, 2017 03:43 — forked from robinhouston/doyle.js
Doyle spiral circle packing
/* Numerics for Doyle spirals.
* Robin Houston, 2013
*/
(function() {
var pow = Math.pow,
sin = Math.sin,
cos = Math.cos,
pi = Math.PI;
@piq9117
piq9117 / typed-immutable.ts
Created August 21, 2017 18:55 — forked from heyimalex/typed-immutable.ts
Pragmatic typed immutable.js records using typescript 2.1+
// Pragmatic typed immutable.js records using typescript 2.1+
// Comment with any suggestions/improvements!
import * as fs from 'fs'
import { Record, Map } from 'immutable'
type Stats = fs.Stats;
// Define the basic shape. All properties should be readonly. This model
// defines a folder because it seemed easy C:
@piq9117
piq9117 / shit.ts
Created July 20, 2017 15:54 — forked from justinwoo/shit.ts
how to ACTUALLY use react-redux with typescript
// install @types/react-redux and other nonsense
import * as React from 'react'
import { connect } from 'react-redux'
import { YourActualAppState } from './wherever-it-is.ts'
export function mapStateToProps({
whatever
}: YourActualAppState) {
return {
@piq9117
piq9117 / Maybe.js
Created July 15, 2017 06:01 — forked from briancavalier/Maybe.js
JavaScript Maybe monad
module.exports = Maybe;
function Maybe(x) {
this._value = x;
}
Maybe.of = of;
Maybe.empty = empty;
var nothingValue = void 0;