This file contains 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
import { Tokenizer } from "./tokenizer.js"; | |
const textOutput = Deno.readTextFileSync("./output/doc.txt"); | |
const textExpected = Deno.readTextFileSync("./expected/doc.txt"); | |
const tokenizer = new Tokenizer([ | |
{ matcher: /\{\{\{/, type: "regex-start" }, | |
{ matcher: /\}\}\}/, type: "regex-end" }, | |
{ matcher: /[a-zA-Z0-9\[\]\(\)\{\}\.\$\-:\!\\ \t]/, type: "string", valueExtractor: x => x } | |
]); |
This file contains 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
async function directoryToObject(dir, walkOpts){ | |
const obj = {}; | |
for await(const file of walk(dir, walkOpts)){ | |
const path = relative(dir, file.path); | |
const split = path.split("/"); | |
let currObj = obj; | |
for(let i = 0; i < split.length; i++){ | |
const part = split[i]; |
This file contains 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 breakOn(selector){ //breaks on selector | |
var o = new MutationObserver(() => { | |
console.log("hello!"); | |
debugger; | |
}); | |
o.observe(document.querySelector(selector), { | |
childList: true | |
}); | |
} |
This file contains 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
#! /usr/bin/env node | |
const util = require("util"); | |
const exec = util.promisify(require("child_process").exec); | |
const port = process.argv[2]; | |
exec(`lsof -t -i :${port}`) | |
.then(result => exec(`kill -9 ${result.stdout}`)) | |
.then(() => console.log(`Killed process using port ${port}`)) | |
.catch(e => { | |
console.log(`Failed. Are you sure there was something using port ${port}?`); |
This file contains 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
import React from "react"; | |
import ReactDOM from "react-dom"; | |
class Alert extends React.Component { | |
constructor(props){ | |
super(); | |
this.state = { | |
dismissed : false, | |
transitionRef : null | |
}; |
This file contains 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() { | |
var scripts = document.getElementsByTagName( 'script' ); | |
var thisScriptTag = scripts[ scripts.length - 1 ]; | |
for (var index = scripts.length - 1; index >= 0; index--) { | |
if (scripts[index].src.indexOf("iframe.js") > -1) { | |
thisScriptTag = scripts[index]; | |
break; | |
} | |
} |
This file contains 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
console.log("Event Apocalypse!"); | |
var elements = Array.prototype.slice.call(document.querySelectorAll("*")); | |
elements.unshift(document); | |
var count = 0; | |
var elCount = 0; | |
elements.forEach(x => { | |
elCount++; | |
let events = getEventListeners(x); | |
for(let key in events){ | |
let eventArray = events[key]; |