Instantly share code, notes, and snippets.

View JsLambdaFun.js
function makeI(){return function(){};}
function makeII(s){return function(){console.log(s);};}
var xi1 = makeI();
var xi2 = makeI();
var xii1 = makeII('xii1');
var xii2 = makeII('xii2');
console.log(xi1 === xi2); //outputs false
View MinifiedLambdaBehavior.java
class MinifiedLambdaBehavior
static Runnable makeI() { return () -> {}; }
static Runnable makeII(String s) { return () -> s.equals(""); }
static Runnable makeIII() { return new Runnable() { public void run() {} }; }
@Test
public void thing() {
Set<Runnable> runnables = new HashSet<>();
View LambdaBehavior.java
public class LambdaBehavior {
interface Mixin {
Map<Mixin, String> backingMap = Collections.synchronizedMap(new WeakHashMap<>());
default String getName() { return backingMap.get(this); }
default void setName(String name) { backingMap.put(this, name); }
}
interface X extends Runnable, Mixin {}
static X makeI() { return () -> System.out.println("x"); }
View squares
#include <vector>
#include <SFML/Graphics.hpp>
#include <math.h>
int main()
{
int resx = 1200;
int resy = resx * 16 / 25;
const int box_count_x = 25;