This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -g utf8 | |
set-window-option -g utf8 on | |
set -g default-terminal "screen-256color" | |
# set Ctrl-a as default prefix | |
set -g prefix C-a | |
unbind C-b | |
# pane navigation | |
bind h select-pane -L |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
var body_parser = require('body-parser') | |
var app = express() | |
var PORT = process.argv[2] | |
app.use(body_parser.json()) | |
app.all('*', function(req, res) { | |
console.log({ headers: req.headers, body: req.body }) | |
res.json({ headers: req.headers, body: req.body }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TODO: add symbol | |
type List = Array<any> | |
type Atom = String | Number | Boolean | |
type Expression = Atom | List | Procedure | Function | |
const zip = (a: any[], b : any[], zipFunc? : (x : any, y : any) => any) => | |
zipFunc ? a.map((value, index) => zipFunc(value, b[index])) | |
: a.map((value, index) => [value, b[index]]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as R from 'ramda' | |
export const joinWith = | |
(list1 : any[], list2 : any[], | |
pred : (item1 : any, item2 : any) => boolean, | |
mapTo : (item1, item2) => any) : any[] => | |
R.chain(item1 => | |
R.map (item2 => mapTo(item1, item2), | |
R.filter (item2 => pred(item1, item2), list2 )) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Reflection; | |
using System.ComponentModel; | |
namespace System | |
{ | |
public static class EnumExtensions | |
{ | |
public static string GetDescription<T>(this T genericEnum) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.AspNetCore.Mvc.Abstractions; | |
using Microsoft.AspNetCore.Mvc.Infrastructure; | |
using Microsoft.AspNetCore.Mvc.ModelBinding; | |
using Microsoft.AspNetCore.Mvc.Razor; | |
using Microsoft.AspNetCore.Mvc.Rendering; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const matched = x => ({ | |
on: () => matched(x), | |
otherwise: () => x, | |
}) | |
const match = x => ({ | |
on: (pred, fn) => (pred(x) ? matched(fn(x)) : match(x)), | |
otherwise: fn => fn(x), | |
}) | |
match(50) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static partial class FuncExtensions | |
{ | |
public static TResult Forward<T, TResult>(this T value, Func<T, TResult> function) => | |
function(value); | |
} | |
public static partial class ActionExtensions | |
{ | |
public static void Forward<T>(this T value, Action<T> function) => | |
function(value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
| |
namespace Nulls | |
{ | |
public struct Maybe<T> : IEquatable<Maybe<T>> | |
where T : class | |
{ | |
private readonly T _value; | |
public T Value | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class YCombinator<T> { | |
delegate Func<T, T> Recursive(Recursive recursive); | |
public static Func<Func<Func<T, T>, Func<T, T>>, Func<T, T>> Fix = | |
f => ((Recursive)(g => (f(x => g(g)(x))))) ((Recursive)(g => f(x => g(g)(x)))); | |
} |