๐
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.function.Function; | |
import java.util.*; | |
import java.util.stream.*; | |
static <X, Y, Z> Map<X, Z> transform(Map<? extends X, ? extends Y> input, | |
Function<Y, Z> function) { | |
return input.keySet().stream() | |
.collect(Collectors.toMap(Function.identity(), | |
key -> function.apply(input.get(key)))); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// LRUCache.js - super simple JavaScript Implementation | |
// LRU stands for "Least Recently Used" | |
// https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU | |
// ----------------------------------------- | |
function LRUNode(key) { | |
this.key = key; | |
this.next = this.prev = null; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { graphql } from 'react-apollo'; | |
import { connect } from 'react-redux'; | |
import { compose } from 'redux'; | |
import { | |
change, | |
getFormSubmitErrors, | |
getFormValues, | |
reduxForm, | |
stopAsyncValidation, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assuming you have a Component Dashboard, AnotherComponent, conditionally render based on props | |
const ROUTES = [ | |
{ | |
test: /\/another$/, | |
Component: Dashboard | |
}, | |
{ | |
test: /\/foo$/, | |
Component: Dashboard | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"points": [ | |
{ | |
"x": 100, | |
"y": 100, | |
"oldx": 50, | |
"oldy": 150 | |
}, | |
{ | |
"x": 200, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<canvas id="canvas"></canvas> | |
<script src="http://webgl2fundamentals.org/webgl/resources/twgl-full.min.js"></script> | |
<script src="http://webgl2fundamentals.org/webgl/resources/webgl-lessons-helper.js"></script> | |
<script src="http://webgl2fundamentals.org/webgl/resources/3d-math.js"></script> | |
<script src="http://webgl2fundamentals.org/webgl/resources/flattened-primitives.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset='utf-8'/> | |
</head> | |
<body style='margin:0px' onload='main()'> | |
<canvas id='your_canvas' | |
style='position: absolute; background-color: black;'></canvas> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/events?filter:collaborators_expire_at=2016-12-20&eventbrite_event_id=16160132391 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.use(function* (next) { | |
this.accountService = {}; | |
for (const method in accountServiceClient) { | |
this.accountService[method] = function* () { | |
try { | |
return yield accountServiceClient[method].apply(null, arguments); | |
} | |
catch (e) { | |
requestLogger.error(e); | |
throw e; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object MindBlown extends App { | |
trait Monoid[A] { | |
def op(a1: A, a2: A): A | |
def zero: A | |
} | |
val intAddition = new Monoid[Int] { | |
override def op(a1: Int, a2: Int) = a1 + a2 | |
override def zero = 0 | |
} |