Skip to content

Instantly share code, notes, and snippets.

View silversillu's full-sized avatar

Silver Ringvee silversillu

  • Tallinn, Estonia
View GitHub Profile
@silversillu
silversillu / mde.js
Created January 17, 2022 10:29
MDE Calculator Code
function ppnd(p) {
a0 = 2.50662823884, a1 = -18.61500062529; a2 = 41.39119773534; a3 = -25.44106049637; b1=-8.47351093090; b2 = 23.08336743743; b3 = -21.06224101826; b4 = 3.13082909833; c0 = -2.78718931138; c1 = -2.29796479134; c2 = 4.85014127135; c3 = 2.32121276858; d1 = 3.54388924762; d2 = 1.63706781897;
var r;
var split = 0.42;
var value;
/* 0.08 < P < 0.92 */
if (Math.abs(p-0.5)<=split){
r=(p-0.5)*(p-0.5);
value=(p-0.5)*(((a3*r+a2)*r+a1)*r+a0)/((((b4*r+b3)*r+b2)*r+b1)*r+1.0);
}
function t(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const e="undefined"!=typeof window;class r{constructor(r){t(this,"_renderer",null),t(this,"_trackedExperiments",new Set),t(this,"debug",!1),t(this,"subscriptions",new Set),t(this,"assigned",new Map),this.context=r||{},e&&(window._growthbook=this)}subscribe(t){return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}getAllResults(){return new Map(this.assigned)}destroy(){this.subscriptions.clear(),this.assigned.clear(),this._trackedExperiments.clear(),e&&window._growthbook===this&&delete window._growthbook}setRenderer(t){this._renderer=t}forceVariation(t,e){this.context&&(this.context.forcedVariations=this.context.forcedVariations||{},this.context.forcedVariations[t]=e,this._renderer&&this._renderer())}run(t){const e=this._run(t),r=this.assigned.get(t.key);return r&&r.result.inExperiment===e.inExperiment&&r.result.variationId===e.variationId||(this.assigned.set(t.key,{experiment:t,
(function(){
clearInterval(window.wait_for_test_elements);
window.wait_for_test_elements = setInterval(function(){
if ( document.querySelector('[data-testid="sidebar"]') ) {
run_all();
if ( document.location.pathname === "/" ) {
run_home();
} else if ( document.location.pathname === "/games" ) {
//run_games();
}
@silversillu
silversillu / rage-clicks.js
Created September 18, 2019 07:36
Tracking Rage Clicks using GTM
if ( typeof(jQuery) === 'function' ) {
jQuery(document).ready(function($) {
jQuery.fn.extend({
getPath: function() {
var path, node = this;
while (node.length) {
var realNode = node[0],
name = realNode.localName;
if (!name) break;
name = name.toLowerCase();
@silversillu
silversillu / Stylefile.yml
Created July 30, 2018 11:09
Customizations for www.styleurl.app via StyleURL.
---
version: 1.0
domains:
- www.styleurl.app
url_patterns:
- www.styleurl.app/*
timestamp: '2018-07-30T11:09:01Z'
id: 14VY
redirect_url: https://www.styleurl.app/?ref=producthunt
shared_via: StyleURL - (https://styleurl.app) import and export CSS changes from Chrome
@silversillu
silversillu / Stylefile.yml
Created July 30, 2018 11:08
Customizations for www.styleurl.app via StyleURL.
---
version: 1.0
domains:
- www.styleurl.app
url_patterns:
- www.styleurl.app/*
timestamp: '2018-07-30T11:08:11Z'
id: pp0x
redirect_url: https://www.styleurl.app/?ref=producthunt
shared_via: StyleURL - (https://styleurl.app) import and export CSS changes from Chrome