Skip to content

Instantly share code, notes, and snippets.

Martin mstepien

Block or report user

Report or block mstepien

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mstepien
mstepien / FunctionalDecoratorPattern.java
Last active Mar 3, 2017
Decorator Pattern done with function composition
View FunctionalDecoratorPattern.java
Coffee coffee = Barista.makeCoffee(
new Arabica(),
Coffee::withMilk,
Coffee::withSprinkles);
System.out.println(
coffee.getIngredients()
+ ". Cost: "+
coffee.getCost());
@mstepien
mstepien / InitializeMapWithLambdaExample.java
Last active Mar 13, 2017
Initialize a Java Map with lambda
View InitializeMapWithLambdaExample.java
/**
* quick and neat way to initialize a Map since Java 8
*/
Map<Integer, String> map = Collections.unmodifiableMap(
Stream.of(
new SimpleEntry<>(0, "zero"),
new SimpleEntry<>(1, "one"),
new SimpleEntry<>(2, "two"),
new SimpleEntry<>(3, "three")
).collect(Collectors.toMap(
@mstepien
mstepien / drive-appscript.js
Last active Jan 1, 2016 — forked from igrigorik/drive-appscript.js
BigQuery queries for the HTTP Archive dataset with some Google BigQuery API code updates: - use of class QueryRequest - http://googleappsdeveloper.blogspot.com/2013/11/code-updates-required-for-apps-script.html
View drive-appscript.js
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [ {name: "Run Query", functionName: "runQuery"} ];
ss.addMenu("HTTP Archive + BigQuery", menuEntries);
}
function runQuery() {
var projectNumber = 'httparchive';
var sheet = SpreadsheetApp.getActiveSheet();
You can’t perform that action at this time.