Skip to content

Instantly share code, notes, and snippets.

View killinit's full-sized avatar
🎯
Focusing

Maciej Adamczewski killinit

🎯
Focusing
View GitHub Profile
@killinit
killinit / array-to-object.js
Created April 13, 2018 06:28 — forked from Daniel-Hug/array-to-object.js
JS arrayToObj(): convert array to object with a key-value map function
// Call arrayToObj() passing your array and function.
function arrayToObj(array, keyValueMap) {
var obj = {};
var len = array.length;
// Your function will be called for each item in the array.
for (var i = 0; i < len; i++) {
var curVal = array[i];
// Just like with [].forEach(), your function will be passed the
// curent item of the array, its index, and the array it's in.
var keyValuePair = keyValueMap(curVal, i, array);
@killinit
killinit / destructuring.js
Created October 12, 2017 06:30 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@killinit
killinit / circle_detection.py
Created August 30, 2017 06:42 — forked from martinsik/circle_detection.py
Circle detection with OpenCV 3.0
import cv2
import time
import math
import numpy as np
capture = cv2.VideoCapture(0)
print capture.get(cv2.CAP_PROP_FPS)
t = 100
w = 640.0
@killinit
killinit / 01-createObservableFromDeviceEventEmitter.js
Created August 27, 2017 19:18 — forked from sectore/01-createObservableFromDeviceEventEmitter.js
[React Native + RxJS] Create an Observable from DeviceEventEmitter - An example to handle 'locationUpdated' event
import React, {DeviceEventEmitter} from 'react-native';
import {Observable} from 'rx-lite'
/**
* Creates an Observable to listen to any event of DeviceEventEmitter
* @param type {string} Event type
*/
export default createObservableFromDeviceEventEmitter$ = type => {
let subscription;
return Observable.fromEventPattern(
@killinit
killinit / nginx-config-rails4-with-puma-ssl-version.conf
Created December 2, 2016 10:48 — forked from rkjha/nginx-config-rails4-with-puma-ssl-version.conf
Nginx config for rails 4 application using puma [ssl and non-ssl version]
upstream myapp_puma {
server unix:/tmp/myapp_puma.sock fail_timeout=0;
}
# for redirecting to https version of the site
server {
listen 80;
rewrite ^(.*) https://$host$1 permanent;
}
@killinit
killinit / README.md
Last active August 29, 2015 14:12 — forked from mbostock/.block

This example demonstrates rendering a D3 force-directed graph using Canvas rather than SVG. The performance is slightly better than SVG, but unlike the SVG version, the nodes in this one are not draggable.