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 uuidv4() { | |
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c => | |
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16) | |
) | |
} | |
console.log(uuidv4()); |
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
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
; Swap the Option/Alt and Command keys for Mac keyboards | |
RAlt::RWin | |
RWin::RAlt | |
LAlt::LWin | |
LWin::LAlt |
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 { useEffect, useState } from 'react'; | |
let intersectionObserver; | |
let intersectionObserverOptions = {}; | |
const subscribers = new WeakMap(); | |
const handleIntersections = entries => | |
entries.forEach(entry => subscribers.get(entry.target).call(null, entry)); | |
const getIntersectionObserver = () => { |
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
const colors = { | |
Reset: "\x1b[0m", | |
Bright: "\x1b[1m", | |
Dim: "\x1b[2m", | |
Underscore: "\x1b[4m", | |
Blink: "\x1b[5m", | |
Reverse: "\x1b[7m", | |
Hidden: "\x1b[8m", | |
FgBlack: "\x1b[30m", |
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
const { get } = require('https') | |
const { readFileSync, writeFileSync } = require('fs') | |
const checkPageForText = (page, text) => { | |
// Make the http request for the resource | |
get(page, resp => { | |
let data = '' | |
// Build the 'data' string as chunks come in |
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
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"strconv" | |
"strings" | |
"time" | |
) |
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
from urllib2 import urlopen | |
import time | |
def scrape(url, term) : | |
# Make the http request for the resource | |
response = urlopen(url) | |
# Read the response body to a variable | |
html = response.read() |
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
extern crate reqwest; | |
use std::time::SystemTime; | |
use std::fs::File; | |
use std::io::prelude::*; | |
fn write_file(filename: &str, data: &str) { | |
let bytes = data.as_bytes(); | |
let mut file = File::create(filename).expect("Error creating file"); | |
file.write_all(bytes).expect("Error writing file"); | |
} |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | |
<style> | |
body { | |
margin: 0; | |
padding: 0; |
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
const fuzzyCompare = (term, compare, tolerance = 0) => { | |
if(term.length > compare.length){ | |
return false; | |
} | |
return term.split('').filter(l => { | |
return compare.split('').find(cl => { | |
return cl === l | |
}); | |
}).length >= (term.length - tolerance) | |
} |