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
class DatabaseError extends Error {} | |
const error = new DatabaseError("Unique constraint violation"); | |
// prints "true" | |
console.log(error instanceof Error); | |
// incorrectly prints "false" | |
console.log(error instanceof DatabaseError); |
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
hyperfine 'lua slow.lua' | |
# Benchmark #1: lua slow.lua | |
# Time (mean ± σ): 1.287 s ± 0.115 s [User: 1.120 s, System: 0.078 s] | |
# Range (min … max): 1.187 s … 1.528 s 10 runs | |
hyperfine 'lua fast.lua' | |
# Benchmark #1: lua fast.lua | |
# Time (mean ± σ): 39.3 ms ± 3.8 ms [User: 34.6 ms, System: 2.8 ms] | |
# Range (min … max): 35.3 ms … 58.3 ms 48 runs |
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 got = require("got"); | |
async function getAwwPost() { | |
const response = await got( | |
"https://www.reddit.com/r/aww/top.json?t=day" | |
).json(); | |
for (const post of response.data.children) { | |
if (post.data.post_hint !== "image") { | |
continue; |
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 twilio = require("twilio")( | |
process.env.TWILIO_ACCOUNT_SID, | |
process.env.TWILIO_AUTH_TOKEN | |
); | |
async function sendText(body, mediaUrl) { | |
const text = await twilio.messages.create({ | |
body, | |
mediaUrl: mediaUrl ? [mediaUrl] : [], | |
from: process.env.TWILIO_PHONE_NUMBER, |
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
# Run from a PowerShell prompt with administrative privileges: | |
# Install-BoxstarterPackage -PackageName <url> -DisableReboots | |
choco install anki | |
choco install autohotkey | |
choco install firefox-dev --pre | |
choco install googlechrome | |
choco install logitechgaming | |
choco install steam | |
choco install todoist |
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
{{ if (findRE "<pre" .Content 1) }} | |
<script src="/js/copy-code-button.js"></script> | |
{{ end }} |
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
if (navigator && navigator.clipboard) { | |
addCopyButtons(navigator.clipboard); | |
} else { | |
var script = document.createElement('script'); | |
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/clipboard-polyfill/2.7.0/clipboard-polyfill.promise.js'; | |
script.integrity = 'sha256-waClS2re9NUbXRsryKoof+F9qc1gjjIhc2eT7ZbIv94='; | |
script.crossOrigin = 'anonymous'; | |
script.onload = function() { | |
addCopyButtons(clipboard); | |
}; |
NewerOlder