Skip to content

Instantly share code, notes, and snippets.

View marcoemrich's full-sized avatar

Marco Emrich marcoemrich

View GitHub Profile
@yukims19
yukims19 / Reant.re
Last active July 2, 2020 08:40
ReasonConf Dojo
type style = ReactDOMRe.Style.t;
type element = React.element;
module Breadcrumb = {
[@bs.module "antd"] [@react.component]
external make:
(~ariaLabel: string=?, ~key: string=?, ~style: style=?, ~children: 'b) =>
element =
"Breadcrumb";
@SamirTalwar
SamirTalwar / random-hacks.ts
Last active August 19, 2019 23:42
Random hacks you can do with TypeScript.
type Status = "passed" | "failed" | "error" | "unknown";
interface Things {
a: string;
b: number;
c: {
d: {
e: string;
};
f: Array<{ g: number }>;
@Avaq
Avaq / combinators.js
Last active May 19, 2024 00:21
Common combinators in JavaScript
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))
@wolframkriesing
wolframkriesing / MonetaryAmount.js
Last active October 23, 2015 13:56
Value Object in JavaScript, or non-primitve value
const valueSymbol = Symbol('value');
class MonetaryAmount {
constructor(value) {
this[valueSymbol] = value;
}
add(amount) {
return new MonetaryAmount(amount.value + this.value);
}
equal(amount) {
return amount.value == this.value;
Idea based on this tweet exchange:
coreyhaines: Architecture where ever class is its own gem, communicating via drb. #thoughtleadering #thoughtlendering
coreyhaines: better yet, every method is its won gem, classes are built up by requiring gems that monkey-patch. #truth
josh_cheek: @coreyhaines As each method is a gem, it needs its a namespace, so it's defined in a module… Compose classes by including method's modules.
coreyhaines: @josh_cheek I do like the idea of composing via module inclusions, as well. Interesting.
coreyhaines: Seriously, though, the idea of defining classes via including single-method modules appeals to me.
So, here's my thought for the workshop. It is based a bit on some of the value that I saw doing coderetreats.
title: Super Awesome Happy Fun Coding Workshop, Great Job
@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@staltz
staltz / introrx.md
Last active May 26, 2024 06:18
The introduction to Reactive Programming you've been missing
These are some features. They can be implemented in any order you prefer.
* an elevator responds to calls containing a source floor and direction
* an elevator delivers passengers to requested floors
* an elevator doesn't respond immediately. consider options to simulate time
* elevator calls are queued not necessarily FIFO
* you may validate passenger floor requests
* you may implement current floor monitor
* you may implement direction arrows
* you may implement doors (opening and closing)
@npryce
npryce / property-based-testing-tools.md
Last active August 14, 2022 20:34
Property-Based Testing Tools

If you're coming to the Property-Based TDD As If You Meant It Workshop, you will need to bring a laptop with your favourite programming environment, a property-based testing library and, depending on the language, a test framework to run the property-based-tests.

Any other languages or suggestions? Comment below.

.NET (C#, F#, VB)

Python: