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
// https://stackoverflow.com/questions/45395369/how-to-get-console-log-line-numbers-shown-in-nodejs | |
['log','warn','error'].forEach((methodName) => { | |
const originalMethod = console[methodName]; | |
console[methodName] = (...args) => { | |
const error = new Error(); | |
originalMethod.apply( | |
console, | |
[ | |
( | |
error |
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 fs = require('fs'); | |
const program = require('commander'); | |
function makeTrailingDots(gremlin) { | |
const lines = gremlin | |
.split('\n') | |
.filter(line => line.length); | |
const lastLineIndex = lines.length - 1; |
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
'use strict'; | |
const fs = require('fs'); | |
const util = require('util'); | |
const contents = fs.readFileSync(0, 'utf8'); | |
const jsonObject = JSON.parse(contents); | |
const javascriptString = util.inspect(jsonObject, { depth: null }); |
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 gremlin = require('gremlin'); | |
const uuidv4 = require('uuid/v4'); | |
const { t: { id }, cardinality } = gremlin.process; | |
const __ = gremlin.process.statics; | |
const hostname = process.env.NEPTUNE_HOST; | |
const testToRun = process.argv[2]; | |
const threadsRequested = process.argv[3] ? Number(process.argv[3], 10) : 5; |
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* getMatches(regex, text) { | |
let match; | |
while((match = regex.exec(text)) != null) { | |
yield match.slice(1); | |
} | |
} | |
const assignmentRegEx = /^(.*)\s+=\s+(.*)\.$/gm; |
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 limit = 1000000; | |
// const limit = Number.MAX_SAFE_INTEGER; | |
const limit = 1000000000; | |
let lastBarLength = 0; | |
let lastBar = ''; | |
console.log('start'); | |
for(let i = 0; i < limit; i++) { |
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
using System; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Xml; | |
namespace Test | |
{ | |
class Test | |
{ | |
static void Main() |
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
# vim | |
yum group install "Development Tools" -y | |
yum install ncurses-devel -y | |
yum install unzip -y | |
yum install wget -y | |
yum install make -y | |
# prereqs copied from YouCompleteMe repo, probably overkill | |
yum install -y python python-devel | |
# yum install -y python3 python3-devel | |
wget -O vim-master.zip https://github.com/vim/vim/archive/master.zip |
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 input = ['I', 'come', 'from', 'mars']; | |
// if you don't want to change the array | |
let i = 0; | |
// roughly shuffle the indexes | |
const shuffledIndexes = input.map(() => i++).sort(i => Math.random() * 3 + -1); | |
for(let j = 0; j < input.length; j++) { | |
console.log(input[shuffledIndexes[j]]); | |
} |
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
'use strict'; | |
// the wrapper | |
function addPromiseToCallback(fn) { | |
const result = function result(err, data) { | |
fn(err, data); | |
if (err) { | |
result.reject(err); | |
return; |