Skip to content

Instantly share code, notes, and snippets.

View cope's full-sized avatar
🖖
live long...

Predrag Stojadinović cope

🖖
live long...
View GitHub Profile
@cope
cope / wtf.js
Last active February 4, 2019 12:53 — forked from artalar/wtf.js
/* VT100 terminal reset (<ESC>c) */
console.log('\033c');
/* numbers comparations */
/**/ [2] == 2;
//// true
/**/ [] + [];
const fs = require('fs');
fs.readdirSync('./').forEach(file => {
if (file.endsWith('.mkv')) {
let clean = file.split('.');
let pos = clean.indexOf('720p');
clean = clean.slice(0, pos).join(' ') + '.mkv';
console.log(file, clean, pos);
fs.renameSync(file, clean);
}
let foobar = document.getElementById('foobar');
foobar.addEventListener('keyup', e => {
let value = e.target.value;
let typing = _.endsWith(value, ' ');
let cursor = e.target.selectionStart;
let addSpace = _.endsWith(value, ' ');
let words = _.split(value, ' ');
words = _.map(words, _.trim);