Skip to content

Instantly share code, notes, and snippets.

@allumbra
allumbra / gist:11359481
Created April 28, 2014 01:12
Decaddance Rules in Clojure
(ns decaddance.core
(:require [clojure.math.numeric-tower :as math]
[clojure.set :as set])
(:use [midje.sweet]
[clojure.core.match :only [match]]
)
)
(def origin [0 0])
@allumbra
allumbra / gist:8035125
Last active December 31, 2015 19:39
Twitter interview question
function mySolution(walls){
var heightLoc = {};
var waterSum = 0;
for(var x=0; x<walls.length; x++){
for(var y=0; y<walls[x]; y++){
var height = y+'';
waterSum += height in heightLoc ? (x - heightLoc[height]) - 1 : 0;
heightLoc[height] = x; // record last time we saw a wall of this height
}
}
;; gorilla-repl.fileformat = 1
;; **
;;; # Coin Board Game or Die
;;; From the puzzle found here: http://fivethirtyeight.com/features/can-you-survive-this-deadly-board-game/
;;;
;; **
;; @@
; namespace and includes...
@allumbra
allumbra / gist:57b9f923a5e81ef83ebb6fefe1480de3
Created January 31, 2019 01:34
LambdaA to invoke LambdaB - circular reference when trying to include LambdaB function name in LambdaA environment
const s3PutLambdaRole = new iam.Role(this, "S3PutLambdaRole", {
assumedBy: new iam.ServicePrincipal("lambda.amazonaws.com")
// managedPolicyArns:
});
bucket.grantRead(s3PutLambdaRole);
const s3EventLambda = new lambda.Function(this, "s3PutHandler", {
runtime: lambda.Runtime.NodeJS810,
code: lambda.Code.directory("resources"),