Skip to content

Instantly share code, notes, and snippets.

View amodig's full-sized avatar

Arttu Modig amodig

View GitHub Profile
@amodig
amodig / deep_equal.js
Created March 29, 2016 12:43
JS deep equal
function deepEqual(o1, o2) {
if (typeof(o1)=="object" && typeof(o2)=="object" && o1 != null && o2 != null) {
for (var prop in o1) {
if (o1[prop] && o2[prop]) {
if (!deepEqual(o1[prop], o2[prop])) {
return false;
}
}
}
return true;
@amodig
amodig / flatten.js
Created April 5, 2016 10:31
JS flatten array of arrays
var arrays = [[1, 2, 3], [4, 5], [6]];
console.log(arrays.reduce(function(a, b) {
return a.concat(b);
}));
@amodig
amodig / vector.js
Created April 14, 2016 12:34
Javascript Vector constructor
function Vector(x, y) {
this.x = x;
this.y = y;
}
Vector.prototype.plus = function(vector) {
var x_new = this.x + vector.x;
var y_new = this.y + vector.y;
return new Vector(x_new, y_new);
}
@amodig
amodig / seq_interface.js
Created April 18, 2016 11:11
JS sequence interface with inheritance example
function ArraySeq(array) {
this.array = array;
}
ArraySeq.prototype.current = function() {
return this.array[0];
}
ArraySeq.prototype.remaining = function() {
if (this.array[1]) {
return new ArraySeq(this.array.slice([1]));
}
OPTBD2909 L'eclisse [Blu-ray]
BFIB1064 Bronco Bullfrog (Blu-Ray and DVD)
BFIB1134 Red Desert (Blu-Ray & DVD)
BFIB1145 You're Human Like The Rest Of Them (Blu-Ray+DVD)
EKA70211 The Last Command (1928) [Masters of Cinema] (Blu-ray & DVD)
BFIB1184 Schalcken the Painter (Dual Format Edition) (DVD & Blu-ray)
BFIB1123 Little Malcolm and His Struggle Against the Eunuchs (DVD + Blu-ray)
BFIB1106 Man of Violence (DVD & Blu-Ray)
BFIB1104 Herostratus - Dual Format Edition (Blu Ray & DVD)
BFIB1101 The Bed Sitting Room (DVD & Blu-Ray)
@amodig
amodig / quantumsiege_notes.adoc
Last active December 15, 2017 07:19
Quantum Siege (first public beta) notes

Quantum Siege Notes

Glossary
  • (DA) denotes things that could be possible to analyze with data (without user tests).

  • (A/B) denotes things that could need an A/B test to verify

The Good Things

  • Excellent graphics with a good framerate.

  • Interesting setting (pretty crazy steampunk-scifi-fantasy-mash-up?)

@amodig
amodig / Dockerfile
Created February 1, 2018 16:04
docker-airflow
FROM debian:9
MAINTAINER Arttu Modig <arttu.modig@gmail.com>
# Never prompts the user for choices on installation/configuration of packages
ENV DEBIAN_FRONTEND noninteractive
ENV TERM linux
ENV LANGUAGE en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
@amodig
amodig / postgres_upsert.py
Created March 9, 2022 10:33
Postgres upsert template
from jinja2 import Template
_POSTGRES_UPSERT_TEMPLATE = Template(
"""
--beginsql
INSERT INTO {{ target_table }}
{{ select_statement }}
ON CONFLICT ({{ primary_keys|join(', ') }}) DO UPDATE SET
{%- for col in target_cols %}