Skip to content

Instantly share code, notes, and snippets.

View rlidwka's full-sized avatar

Alex Kocharin rlidwka

  • Tbilisi, Georgia
View GitHub Profile
@rlidwka
rlidwka / gist:892d08876d737e265a86
Last active August 29, 2015 14:04
mincer benchmark
#!/usr/bin/env node
var Mincer = require('mincer');
var env = new Mincer.Environment();
env.appendPath('/home'); // or whereever you have a big bunch of files
var manifest = new Mincer.Manifest(env, '.');
var date = Date.now();
manifest.compile(['some-nonexistent-file']);
@rlidwka
rlidwka / gist:8b904ca00b1e76731270
Last active September 30, 2016 12:50
Looking for a static analysis tool

TL;DR:

I'm testing five linters (jshint, jslint, eslint, gjslint, javascriptlint) - that's all that I could find - for two common and easily detectable errors.

But they don't find any, so I'm asking the community to suggest one that can.


Here is a piece of code. You know that pattern that makes a constructor callable without "new"?

@rlidwka
rlidwka / stuff.js
Last active April 5, 2018 19:40
finding the closest frakking number
function get_digit(n, d) {
return Math.floor(n / Math.pow(10, d)) % 10
}
function is_unique(n, d) {
let m = 0
let c = Math.pow(10, d)
for (let i = d; n > c; i++, c *= 10) {
let new_m = m ^ (2 << get_digit(n, i) + 1)