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 http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Timer</title> | |
<style> | |
body { | |
margin: 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
import argparse | |
import logging | |
import subprocess | |
from collections.abc import Iterable | |
from contextlib import contextmanager | |
from inspect import cleandoc | |
from pathlib import Path | |
from tempfile import NamedTemporaryFile | |
logging.basicConfig() |
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
javascript: (function () { | |
const remoteScript = document.createElement('script'); | |
remoteScript.src = 'https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit'; | |
remoteScript.type = 'text/javascript'; | |
document.body.appendChild(remoteScript); | |
const containerElem = document.createElement('div'); | |
containerElem.id = 'google_translate_element'; | |
document.body.insertBefore(containerElem, document.body.firstChild); | |
const localScript = document.createElement('script'); | |
localScript.type = 'text/javascript'; |
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
# Automate npm updating when using nvm-windows | |
# Installs npm@latest for the current active node install | |
# Source: https://github.com/coreybutler/nvm-windows/issues/300#issuecomment-368192283 | |
$ErrorActionPreference = "Stop" | |
# Create a folder in the Temp directory and return it | |
# Source: https://stackoverflow.com/a/34559554/9165387 | |
function New-TemporaryDirectory { | |
$parent = [System.IO.Path]::GetTempPath() | |
$name = [System.IO.Path]::GetRandomFileName() |
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 makeGraphBase(width, height) { | |
return Array(height).fill(undefined).map(row => Array(width).fill('⬜')); | |
}; | |
function makeData() { | |
return [0, 1, 2, 4, 4, 3]; | |
}; | |
function diff(val, index, array) { | |
return array[index + 1] - val; |
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
/** | |
* Return an array of objects representing a triangle wave, with a values and direction for each point. | |
* @param {Number} length - The desired length of the array. | |
* @param {Number} height - The desired peak value for the wave. | |
* @returns {Object[]} - Array of objects like `{wiggle: <Number>, wiggle_down: <Boolean>}`. | |
*/ | |
function makeWiggle(length, height) { | |
const output = [] | |
let wiggle = 0; | |
let wiggle_down = false; |
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 undefinedSin() { | |
// Save the original sine function | |
const originalSin = Math.sin; | |
// Encapsulate a scaled sine function | |
const sinScaled = function sinScaled(value, xScale, yScale) { | |
return originalSin((value * Math.PI) / xScale) * yScale; | |
}; | |
// Function that returns a graph formed by the string representation of the input |
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 python3 | |
'''Dowload the comic *On a Sunbeam*''' | |
import shutil | |
from urllib.parse import urljoin, urlparse | |
from os.path import basename | |
import requests | |
from bs4 import BeautifulSoup | |
def get_chapter_links(url): |
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
/** Pass an object with `asker`, `question`, and `details` properties for the given Yahoo Answers | |
* question page URL to the callback function. | |
*/ | |
(function getYahooQuestion(url, callback) { | |
/** Error to throw when a user data ID cannot be found. */ | |
class NoUserDataIdError extends Error { | |
constructor() { | |
super(); | |
this.name = 'NoUserDataIdError'; |
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
<# | |
.SYNOPSIS | |
Download and extract music from http://middle-earth.thehobbit.com/ | |
#> | |
# Get dmaf JSON file | |
$dmaf_assets_url = 'http://middle-earth.thehobbit.com/stable.380729695375977266/assets/dmaf_assets/' | |
$data = Invoke-WebRequest -Uri ($dmaf_assets_url + 'json/dmaf_data.json') | ConvertFrom-Json | |
# Get the section of JSON that we're interested in |
NewerOlder