Skip to content

Instantly share code, notes, and snippets.

View nLight's full-sized avatar
:shipit:

Dmitriy (Dima) Rozhkov nLight

:shipit:
View GitHub Profile
@nLight
nLight / source-unmap.js
Created August 31, 2016 13:40
Unmap source map
var sourceMap = require('source-map');
var https = require('https');
var fs = require('fs');
var args = process.argv.slice(2);
if(args.length === 0) {
console.log("Usage: node index.js https://url.to/script.js:<line>:<column>");
return;
}
@nLight
nLight / stream.js
Last active August 3, 2018 20:11
Mesos stream replay server
const http = require('http')
const port = 3000
var fs = require('fs');
const requestHandler = (request, response) => {
console.log("Connected")
response.setHeader("Access-Control-Allow-Origin", "*")
response.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept")
@nLight
nLight / better-hash-function.js
Created October 19, 2019 09:21
Javascript Hash Table
function hash(string) {
let index = 0;
for(let i = 0; i < string.length; i++) {
index += string.charCodeAt(i) * i;
}
return index % _size;
}