This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = require('request'); | |
function makeANewTable(idx, limit) { | |
const urlEncodedQuery = encodeURIComponent(`CREATE TABLE IF NOT EXISTS trades${idx} (ts TIMESTAMP, date DATE, name STRING, value INT) timestamp(ts);`); | |
const wholeUrl = 'http://localhost:9000/exec?query=' + urlEncodedQuery; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For those really really annoying manual reviews <.< | |
$(".slider.slider-horizontal").each(function() { | |
const sliderBoundingRect = this.getBoundingClientRect(); | |
const rightEdgeOfSlider = (sliderBoundingRect.left + sliderBoundingRect.width); | |
const mouseDownEvt = new MouseEvent("mousedown", {clientY: sliderBoundingRect.top, clientX: rightEdgeOfSlider}); | |
this.dispatchEvent(mouseDownEvt); | |
const mouseUpEvt = new MouseEvent("mouseup", {clientY: sliderBoundingRect.top, clientX: rightEdgeOfSlider}); | |
document.dispatchEvent(mouseUpEvt); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <limits.h> | |
int main(void) | |
{ | |
int len; | |
int len2; | |
/* Some tests with 1 arg */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Here Do some cleanup | |
DROP DATABASE IF EXISTS trollrepellent; | |
CREATE DATABASE trollrepellent TEMPLATE = template0; | |
\connect trollrepellent | |
create extension if not exists pgcrypto; | |
create extension if not exists "uuid-ossp"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function flattenArr(nestedArr, retVal = []) { | |
nestedArr.forEach(val => { | |
// this should be the only check since no object are expected | |
const isArr = (typeof val === 'object'); | |
if(isArr) { | |
flattenArr(val, retVal); | |
} else { | |
retVal.push(val); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Vector = require('vector'); | |
const Tangible = require('tangible') | |
class Chart extends Tangible { | |
constructor(options) { | |
super(null, new Vector(options.width, options.height)); | |
} | |
get margin() { return this._margin; } | |
set margin(obj) { | |
// only do a partial update if necessary | |
this._margin = _.assign({}, this.margin, obj); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function chart() { | |
this.init(); | |
} | |
_.assign(chart.prototype, { | |
xAxis: function(opt) { | |
if (!val) { return this.state.xAxis; } | |
this.state.xAxis = _.assign(defaultXAxisOptions, opt); | |
return this; | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
function flatten(obj, prevObj, path) { | |
var newPath = null, | |
makeNewPath = function(p, j) { | |
return p ? (p + '.' + j) : j; | |
}; | |
// stop undefined from being printed | |
path = path || ''; | |
prevObj = prevObj || {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var sumOfAnyTwo = function(sum, operandsArr) { | |
var oper1 = null, | |
oper2 = null; | |
for(var i = 0; i < operandsArr.length; i++) { | |
for(var j = 0; j < operandsArr.length; j++) { | |
if(j !== i) { | |
if(operandsArr[i] + operandsArr[j] === sum) { | |
return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Num(v, precision) { | |
this.val = v; | |
var multiplier = Math.pow(10, precision || 3), | |
// Helper fn, Makes a new num for chaining | |
m = function(n) { | |
return new Num(n, Math.log10(multiplier)); | |
} | |
// pseduo operand overriding to allow for generic addition of nums | |
this.valueOf = function() { | |
return this.val * multiplier; |
NewerOlder