Skip to content

Instantly share code, notes, and snippets.

@remydagostino
remydagostino / beverage-buddies.js
Created December 24, 2020 02:29
Beverage Buddies V2
// Usage: node beverage-buddies.js people-list.txt history.txt showPairingStamped
const { readFileSync } = require('fs');
const process = require('process');
function main(peopleFile, historyFile, command) {
const peopleLines = removeComments(readFileSync(peopleFile).toString().split('\n'));
const historyLines = readFileSync(historyFile).toString().split('\n');
const now = Date.now();
@remydagostino
remydagostino / beverage-buddy.js
Created October 26, 2020 04:08
Social Beverage Programme
// Usage: node matcher.js people-list.txt 2
const people = require('fs').readFileSync(process.argv[2]).toString().split('\n');
const weekNum = Number(process.argv[3]);
const pairs = people
.map((person, index) => people[(index + weekNum) % people.length])
.map((person, index, list) => {
const match = list[list.length - index - 1];
if (match === person) {
@remydagostino
remydagostino / keybase.md
Created October 7, 2020 06:04
keybase.md

Keybase proof

I hereby claim:

  • I am remydagostino on github.
  • I am rdagostino (https://keybase.io/rdagostino) on keybase.
  • I have a public key ASD5nmQlyySYoW4O0t4CzAotq4NrH-bmAuAH5IR2GfWsAQo

To claim this, I am signing this object:

@remydagostino
remydagostino / launcher_idea.bat
Created May 2, 2018 19:09
Dani's powerpoint extravaganza
POWERPNT.exe /s "<name of file goes here>.ppt"
@remydagostino
remydagostino / promise-example.js
Created November 17, 2017 16:58
Learning exercise for promises (advanced)
// Here we try to use first principles to hack together a very scrappy version
// of a javascript Promise which doesn't implement the A+ spec.
// This is a learning exercise and there are many edge-cases for which this code
// does not handle (such as attaching several callbacks to one promise).
// A good challenge for your understanding might be to modify the code so that
// it could allow several callbacks to be attached to a single promise.
// An broken example is shown at the bottom of the file.
@remydagostino
remydagostino / roman-simple.hs
Last active August 12, 2016 22:50
Calculate the roman numeral string for a number
module RomanNumerals.Simple (integerToRomanString) where
import Data.List (find)
import Data.Maybe (maybe)
integerToRomanString :: Integer -> Maybe String
integerToRomanString v =
let
sortedVals :: [(String, Integer)]
sortedVals =
@remydagostino
remydagostino / future.js
Created June 27, 2016 14:54
Minimal continuation passing construct
function thenable(action) {
var self = {
fork: function(succ, err) {
action(succ || function() {}, err || function() {});
},
then: function(fn) {
return thenable(function(resolve, reject) {
self.fork(
function(data) {
var step = fn(data);
@remydagostino
remydagostino / personal-pronouns.md
Last active February 15, 2016 22:32
German Pronoun practice
| Ich  | Du    | Er   | Sie  | Es   | Wir   | Ihr  | Sie

----|------|-------|------|------|------|-------|------|------ | gebe | gibst | gibt | gibt | gibt | geben | gibt | geben | mir | dir | ihm | ihr | ihm | uns | euch | ihnen | es | es | ihn | sie | es | es | es | es für | mich | dich | ihn | sie | es | uns | euch | ihnen

  • Ich gebe mir es für mich
  • Du gibst dir es für dich
  • Er gibt ihm ihn für ihn
@remydagostino
remydagostino / typeclasses.hs
Last active February 21, 2016 17:56
Getting the hang of haskell typeclasses
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
module Main where
import Data.Monoid (Monoid, mempty, mappend, mconcat)
------------------------------
-- Part 1: Make a silly monoid instance for Int
@remydagostino
remydagostino / food.md
Last active December 8, 2015 18:18
Vegan Berlin

These are my favorite vegan places in Berlin.

I've mostly avoided raw food because I don't usually like it, but if you're interested you'll probably find plenty in Berlin.

There's a big bias toward places that are near where I live, but there are many, many more places. You should use this map to find them.

Vegan berlin map

The list