Skip to content

Instantly share code, notes, and snippets.

laser / vanilla.js
Last active November 4, 2023 04:01
Socket.IO + Vanilla JS
View vanilla.js
var request = require('request-json'),
express = require('express'),
app = express(),
http = require('http').Server(app),
io = require(''),
db = require('mongodb').MongoClient;
// boilerplate code: ignore
laser / 0a.hs
Last active April 13, 2023 14:06
An Introduction to ADTs and Structural Pattern Matching in TypeScript
View 0a.hs
data Failable t e = Success t | Failure e
laser / formatter.rb
Last active November 3, 2022 22:29
A Procfile formatting script, written in Ruby
View formatter.rb
#!/usr/bin/env ruby
require 'optparse'
def get_procfile_lines"\n")
def get_process_type_max_width(lines)
processes = []
laser / interface.idl
Created April 14, 2014 17:29
03: UserService IDL
View interface.idl
// services/user_service/interface.idl
struct UserProperties {
email string
full_name string
phone_number string [optional]
struct User extends UserProperties {
id int
laser /
Created March 31, 2020 18:31
start daemon with custom genesis block
#!/usr/bin/env bash
BASEDIR=$(mktemp -d -t "lotus-interopnet.XXXX")
git clone --branch "testnet/3" "${BASEDIR}/build"
mkdir -p "${BASEDIR}/scripts"
mkdir -p "${BASEDIR}/bin"
laser /
Last active November 18, 2020 19:02

Movie Ticket Kata

First, head here to join our Zoom meeting. It will help me following along while you work through the assignment.

What Are We Building?

Write a program that calculates purchase price for movie tickets using any language you like. It should not be a full-blown web app; it can be a simple class or collection of methods invokable by your test suite. We'll provide you with some requirements, test-cases, and even a sample interface - all you have to do is give us some software.

Base Admission Rate

laser /
Last active September 20, 2020 07:43
Cousera - Python Notes

Week 4


  • Cannot change
  • Examples: 1, 9.12, True, or "Foo"


laser /
Last active June 26, 2020 16:13
Run Filecoin storage and retrieval flows on a local development network
#!/usr/bin/env bash
# Option 1: Build and run tests using specific lotus Git SHA:
# > ./ --lotus-git-sha=15b3e57634458af983082dcbb736140bba2abfdb
# Option 2: Build and run using binaries you've built previously (much faster)
#!/usr/bin/env bash
set -x
public_ip=$(curl -m 5 || echo "")
daemon_multiaddr=$(lotus net listen | grep 127 | sed -En "s/127\.0\.0\.1/${public_ip}/p")
miner_multiaddr=$(lotus-storage-miner net listen | grep 127 | sed -En "s/127\.0\.0\.1/${public_ip}/p")
miner_id=$(lotus-storage-miner info | grep Miner | cut -d ' ' -f2)
cd $(mktemp -d)
laser /
Last active May 12, 2020 09:54
An ADT-Based Alternative to Dependency Injection in TypeScript


Like unit testing but dislike mocks and stubs? Want to keep your business logic separate from your side effects? In this blog post, I'll demonstrate a novel approach to testing which relies not on the [Dependency Injection][4] pattern, but an algebraic data structure and some simple functions.

A Real World Example

I was recently working on a system for a real estate company which merged a