Skip to content

Instantly share code, notes, and snippets.

View kdzwinel's full-sized avatar

Konrad Dzwinel kdzwinel

View GitHub Profile
@kdzwinel
kdzwinel / trilateration.js
Created January 3, 2014 09:35
Simple trilateration algorithm implementation in JavaScript.
function getTrilateration(position1, position2, position3) {
var xa = position1.x;
var ya = position1.y;
var xb = position2.x;
var yb = position2.y;
var xc = position3.x;
var yc = position3.y;
var ra = position1.distance;
var rb = position2.distance;
var rc = position3.distance;
@kdzwinel
kdzwinel / optimizely.js
Created June 17, 2015 21:31
Calculating A/B Test Sample Size
"use strict";
//based on https://www.optimizely.com/resources/sample-size-calculator/
function getSampleSize() {
let effect = 0.05; // Minimum Detectable Effect
let significance = 0.95; // Statistical Significance
let conversion = 0.05; // Baseline Conversion Rate
let c = conversion - (conversion * effect);
let p = Math.abs(conversion * effect);
@kdzwinel
kdzwinel / jsk.c
Created January 19, 2017 00:38
JSK -JPEG Scan Killer
/*
* jsk.c
*
* Copyright (C) 2013, Frederic Kayser.
*
*/
#include <stdio.h>
#include <stddef.h>
@kdzwinel
kdzwinel / main.js
Last active May 2, 2024 05:30
List all undefined CSS classes
/*
This script attempts to identify all CSS classes mentioned in HTML but not defined in the stylesheets.
In order to use it, just run it in the DevTools console (or add it to DevTools Snippets and run it from there).
Note that this script requires browser to support `fetch` and some ES6 features (fat arrow, Promises, Array.from, Set). You can transpile it to ES5 here: https://babeljs.io/repl/ .
Known limitations:
- it won't be able to take into account some external stylesheets (if CORS isn't set up)
- it will produce false negatives for classes that are mentioned in the comments.