Skip to content

Instantly share code, notes, and snippets.

View gerardpaapu's full-sized avatar
🏠
Working from home

Gerard Paapu gerardpaapu

🏠
Working from home
View GitHub Profile
@gerardpaapu
gerardpaapu / SerumBelcher.md
Last active May 12, 2020 06:12
Is it worth it to run Serum Powder in Char-belcher?

Hi all,

I've been looking for some math on whether Serum Powder can be a net benefit for a deck like belcher that has to mulligan a lot to see specific cards. The effect of Serum Powder as I understand it is essentially two things

The benefit is that we can exile cards that we aren't looking for and draw more cards than if we had used a traditional mulligan.

/*
The deck is:
4 Chancellor
0-4 Serum Powder
11 Fetch Spell (a one mana green sorcery that can fetch a basic)
4 Renegade Map
2 Forest
1 Mountain
34-38 Other
module Main where
import Prelude
import Data.Foldable (sum)
import Data.List.Lazy (filter, takeWhile)
import Data.List.Lazy.Types (List)
import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..))
import Data.Unfoldable (unfoldr)
module Main where
import Prelude
import Control.Monad.Eff.Console (logShow)
import Data.Array ((..))
import Data.Array as A
import Data.Foldable (sum)
import TryPureScript (render, withConsole)
function makeCSVReader(records, opts) {
'use strict';
function noop() {}
function createRecordConstructor(fields) {
var src = '';
for (var i = 0; i < fields.length; i++) {
src += 'this[' + JSON.stringify(fields[i]) + '] = fields[' + i + '];\n';
}
@gerardpaapu
gerardpaapu / output.txt
Created August 13, 2014 21:47
classes that don't match the names of the files they are provided from
Ext.data.writer.Json => overrides4.2.js
XERO.Application => XERO\app\Application.js
Ext.util.Router => XERO\app\Router.js
Ext.Router => XERO\app\Router.js
XERO.widget.Menu => XERO\base\Menu.js
Ext.ButtonManager => XERO\button\Button.js
Ext.Buttons => XERO\button\Button.js
Ext.button.Button => XERO\button\Button.js
XERO.column => XERO\column\DemoColumns.js
XERO.combo.settings.AddressFinder => XERO\combo\AddressFinder.js
@gerardpaapu
gerardpaapu / README.md
Last active August 29, 2015 13:57
Optimizer for the filtering subset of our query language

We have a filter, that we want to mechanically prepend conditions to, and we don't want the filter to just get bigger every time we do it. One approach is a function to reduce a filter down to its minimal form (while maintaining correctness).

this function optimize, reduces the ast by propagating constraints over variables to the other side of the && operator, i.e while evaluating the expression to the right of the && we can know that the expression to the left is necessarily true.

We also know that (in the absence of side-effects), A &amp;&amp; B is

@gerardpaapu
gerardpaapu / Either.js
Last active December 24, 2017 11:38
A lazy Either monad for TypeScript
define(["require", "exports"], function(require, exports) {
var Either = (function () {
function Either(doFork) {
this.doFork = doFork;
}
Either.fail = function (error) {
return new Either(function (f, g) {
return g(error);
});
};
@gerardpaapu
gerardpaapu / IO.sjs
Last active August 7, 2017 23:51
Async IO Monad for Javascript
function IO(unsafePerform) {
this.unsafePerform = unsafePerform;
}
IO.prototype.of = IO.of = function (v) {
return new IO(function (ctx, cb) {
cb(null, v);
});
};
define(function () {
var infix = /\{(\d+)((:[_a-z][_a-z0-9]*)(\|[_a-z][_a-z0-9]*))?\}/gmi;
var filters = {};
function getFilter(k) {
if (!(k in filters)) {
throw new Error('No such filter: "' + k + '"');
}
return filters[k];
}