Skip to content

Instantly share code, notes, and snippets.

View beverage-buddies.js
// 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 Oct 26, 2020
Social Beverage Programme
View beverage-buddy.js
// 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) {
View 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
Dani's powerpoint extravaganza
View launcher_idea.bat
POWERPNT.exe /s "<name of file goes here>.ppt"
@remydagostino
remydagostino / promise-example.js
Created Nov 17, 2017
Learning exercise for promises (advanced)
View promise-example.js
// 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 Aug 12, 2016
Calculate the roman numeral string for a number
View roman-simple.hs
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 Jun 27, 2016
Minimal continuation passing construct
View future.js
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 Feb 15, 2016
German Pronoun practice
View personal-pronouns.md
| 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 Feb 21, 2016
Getting the hang of haskell typeclasses
View typeclasses.hs
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
module Main where
import Data.Monoid (Monoid, mempty, mappend, mconcat)
------------------------------
-- Part 1: Make a silly monoid instance for Int
View food.md

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