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 / ngrxintro.md
Created September 14, 2016 23:49 — forked from btroncone/ngrxintro.md
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

#Comprehensive Introduction to @ngrx/store By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@piq9117
piq9117 / Maybe.ts
Last active May 8, 2017 03:07 — forked from co1rowjp/gist:3845888
TypeScript Maybe
interface Functor {
fmap: (any) => any;
}
interface Monad extends Functor {
bind: (any) => Monad;
}
interface Maybe extends Monad {
}
@piq9117
piq9117 / Monad-maybe.ts
Last active May 8, 2017 03:08 — forked from co1rowjp/gist:4252025
TypeScript Maybe(I want pattern match..)
interface Functor {
fmap: (any) => any;
}
interface Monad extends Functor {
bind: (any) => Monad;
}
interface MaybeMatcher {
just: (any) => Maybe;
@piq9117
piq9117 / app-1.spec.ts
Created January 4, 2017 03:37 — forked from wkwiatek/app-1.spec.ts
Angular 2 test snippets for Angular final version. Codebase for https://developers.livechatinc.com/blog/category/programming/angular-2/
// App
import { Component } from '@angular/core';
@Component({
selector: 'app',
template: '<span>{{ sayHello() }}</span>',
})
export class App {
public name: string = 'John';
@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;
@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 / 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 / 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 / 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 / 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 = [