Regex: /^\[.+] (.+): /gm
Original text:
[16:30, 2/1/2018] Sender 1 Name: <Message>
[16:31, 2/1/2018] Sender 2 Name: <Message>
Selection (delete this):
[16:30, 2/1/2018] Sender 1 Name:
var cosineSimilarity = (A, B)=> { | |
let dotProduct = (a, b)=> { | |
if(a.length!=b.length) throw Error("Bad vector"); | |
let sum = 0; | |
for(let i = 0; i<a.length; i++) { | |
sum+=(a[i]*b[i]); | |
} | |
return sum; | |
}; | |
let magnitude = (a)=> { |
class Vector { | |
constructor(VectorArray) { | |
//TODO: Check things? | |
this._values = VectorArray; | |
} | |
toArray() { | |
return this._values; | |
} | |
get length() { | |
return this._values.length; |
// List all files in a directory in Node.js recursively in an asynchronous fashion | |
let walkAsync = async(dir, filelist)=> { | |
if( dir[dir.length-1] != '/') dir=dir.concat('/') | |
let fse = fse || require('fs-extra'), | |
files = await fse.readdir(dir); | |
filelist = filelist || []; | |
for (let file of files) { | |
if ((await fse.stat(dir + file)).isDirectory()) { |
Regex: /^\[.+] (.+): /gm
Original text:
[16:30, 2/1/2018] Sender 1 Name: <Message>
[16:31, 2/1/2018] Sender 2 Name: <Message>
Selection (delete this):
[16:30, 2/1/2018] Sender 1 Name:
{ "content_security_policy": "script-src 'self' https://www.google-analytics.com; object-src 'self'" }
window.onload = ()=>{
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA--', 'auto');
// Paste into the console (F12) | |
(()=> { | |
let removeN = (element)=>{ | |
if(!element.textContent) return; | |
element.textContent = element.textContent.split('n').join(''); | |
element.textContent = element.textContent.split('N').join(''); | |
} | |
let elements = [...document.body.children]; | |
while(elements.length>0) { |
const fs = require('fs'); | |
const path = require('path'); | |
async function walk(dir) { | |
return new Promise((resolve, reject) => { | |
fs.readdir(dir, (error, files) => { | |
if (error) return reject(error); | |
Promise.all(files.map((file) => { | |
return new Promise((resolve, reject) => { | |
const filepath = path.join(dir, file); |
<http://example.org/person/Nassim_Taleb> <http://example.org/relation/author> <http://example.org/books/The_Black_Swan> . | |
<http://example.org/person/Nassim_Taleb> <http://example.org/relation/author> <http://example.org/books/Antifragile> . | |
<http://example.org/person/Nassim_Taleb> <http://example.org/relation/author> <http://example.org/books/Skin_in_the_Game> . |
@prefix p: <http://example.org/person/> . | |
@prefix rel: <http://example.org/relation/> . | |
@prefix book: <http://example.org/book/> . | |
p:Nassim_Taleb rel:author book:The_Black_Swan, | |
book:Antifragile, | |
book:Skin_in_the_Game. |
const isMounted = React.useRef(false); | |
React.useEffect(() => { | |
isMounted.current = true; | |
return () => { | |
isMounted.current = false; | |
}; | |
}, []); |