Skip to content

Instantly share code, notes, and snippets.

Avatar

Benjamin Corliss allumbra

View GitHub Profile
@allumbra
allumbra / gist:57b9f923a5e81ef83ebb6fefe1480de3
Created Jan 31, 2019
LambdaA to invoke LambdaB - circular reference when trying to include LambdaB function name in LambdaA environment
View gist:57b9f923a5e81ef83ebb6fefe1480de3
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"),
View gist:f1c1f9089c23d1f032eded80b54f1cfc
;; 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:11359481
Created Apr 28, 2014
Decaddance Rules in Clojure
View gist:11359481
(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 Dec 31, 2015
Twitter interview question
View gist:8035125
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
}
}
You can’t perform that action at this time.