Skip to content

Instantly share code, notes, and snippets.

@szymonkaliski
szymonkaliski / hot-reload.js
Last active November 27, 2015 21:39
hot reload node.js require()
require('../src/app');
var chokidar = require('chokidar');
var ignore = [ 'node_modules', 'backend' ]; // directories to ignore
var watcher = chokidar.watch('./src/*/');
var reloadCache = function(path) {
Object.keys(global.require.cache)
.filter(function(key) {
return ignore.every(function(value) {
(def google-get-cache (atom (cache/ttl-cache-factory {} :ttl (* 1000 60 60 1))))
(defn google-get [access-token path]
(-> (client/get (str "https://www.googleapis.com/calendar/v3/" path)
{:query-params {:access_token access-token}
:accept :json})
:body
(json/read-str :key-fn #(-> % ->kebab-case keyword))))
(defn google-get-cached [access-token path]
@szymonkaliski
szymonkaliski / BZWBK_online_portfolio_currency_converter.js
Created February 29, 2016 17:30
UserScript for converting everything in BZWBK panel into PLN, keeping it here so I won't loose it.
// ==UserScript==
// @name BZWBK Currency Converter
// @version 0.1
// @description computes currency in BZWBK online panel to display everything in PLN
// @author You
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser-polyfill.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js
// @require https://cdnjs.cloudflare.com/ajax/libs/money.js/0.2.0/money.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/accounting.js/0.4.1/accounting.min.js

Keybase proof

I hereby claim:

  • I am szymonkaliski on github.
  • I am szymonkaliski (https://keybase.io/szymonkaliski) on keybase.
  • I have a public key ASD2G2YJgkYAlDxtlFjz9ObDKeTCi4pT9lO0fnhU9iPB-wo

To claim this, I am signing this object:

@szymonkaliski
szymonkaliski / jc_voronoi.h
Created April 15, 2017 10:43 — forked from kylemcdonald/jc_voronoi.h
C++ app for Voronoi relaxation of CSV points using https://github.com/JCash/voronoi
/*
ABOUT:
A fast single file 2D voronoi diagram generator.
HISTORY:
0.2 2016-12-30 - Fixed issue of edges not being closed properly
- Fixed issue when having many events
@szymonkaliski
szymonkaliski / perlin-noise-classical.js
Last active July 3, 2017 18:20 — forked from banksean/perlin-noise-classical.js
javascript perlin noise generators wrapped for use with requirejs
// Ported from Stefan Gustavson's java implementation
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
// Read Stefan's excellent paper for details on how this code works.
//
// Sean McCullough banksean@gmail.com
//
// require.js wrap by Szymon Kaliski contact@treesmovethemost.com
define([], function() {
/**
@szymonkaliski
szymonkaliski / map.js
Last active July 17, 2017 06:40
example of using Leaflet with Neutron (https://github.com/szymonkaliski/Neutron)
const L = require('leaflet');
const csv = require('comma-separated-values');
const fs = require('fs');
const fileData = fs.readFileSync('quakes.csv').toString();
const csvData = csv.parse(fileData);
const linkEl = document.createElement('link');
linkEl.rel = 'stylesheet';
linkEl.href = 'file:///' + __dirname + '/node_modules/leaflet/dist/leaflet.css';
@-webkit-keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
#sVim-command {
@szymonkaliski
szymonkaliski / sVimrc
Last active May 5, 2018 08:30
sVimrc
set nosmoothscroll
let hintcharacters = "asdfewjklio"
let scrollduration = 0
unamp e
unmap "shift+d"
unmap "shift+e"
unmap "shift+g"
unamp 0
unmap $
@szymonkaliski
szymonkaliski / index.js
Last active January 11, 2019 23:48
(un)constrained optimisation
const { uncmin } = require("numeric");
const fmin = require("fmin");
const data = require("./intervals-data.json");
document.body.style.display = "flex";
const makeDiv = title => {
const div = document.createElement("div");
const text = document.createElement("div");