Create Bookmarklet (browser bookmark that executes Javsacript) to copy a given text to Clipboard.
This is the base javascript:
(function (text) {
var node = document.createElement('textarea')
var selection = document.getSelection()
# shortcuts | |
alias dl="cd ~/Downloads" | |
alias dt="cd ~/Desktop" | |
alias p="cd ~/Projects" | |
# Get macOS Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages | |
alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup; npm install npm -g; npm update -g;' | |
# Google Chrome | |
alias chrome='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome' |
import SwiftUI | |
import PlaygroundSupport | |
struct iPod: View { | |
var body: some View { | |
VStack(spacing: 40) { | |
Screen() | |
ClickWheel() | |
Spacer() | |
} |
// https://stackoverflow.com/a/20871714 | |
const permutator = (inputArr) => { | |
let result = []; | |
const permute = (arr, m = []) => { | |
if (arr.length === 0) { | |
result.push(m) | |
} else { | |
for (let i = 0; i < arr.length; i++) { | |
let curr = arr.slice(); |
// https://codepen.io/anon/pen/EpBJwR | |
const defaultOptions = { height: 100, width: 500 }; | |
const generateSparkline = (data, options) => { | |
options = Object.assign({ defaultOptions, options }); | |
const points = data.reduce((acc, [x, y], i) => { | |
x = (options.width / data.length) * i; | |
return acc + `${x},${options.height - y}\n`; | |
}, ''); |
const capitalize = word => word[0].toUpperCase() + word.slice(1).toLowerCase() | |
const abbreviate = (str, length=2) => { | |
str = str | |
.split(' ') | |
.map(word => word.toUpperCase() === word ? capitalize(word) : word) | |
.join(' '); | |
const ret = []; | |
str.replace(/([A-Z])/g, (match, p1) => { |
const letterMap = { | |
"A": 2, | |
"B": 3, | |
"C": 5, | |
"D": 7, | |
"E": 11, | |
"F": 13, | |
"G": 17, | |
"H": 19, | |
"I": 23, |
const animationFrame = () => new Promise(window.requestAnimationFrame); | |
const load = (el=window) => new Promise(resolve => el.onload = resolve); | |
const timeout = (time) => new Promise(resolve => setTimeout(resolve, time)) |
The purpose of the Yik Yak status API is to allow a third-party application to set the status of a Yik Yak user programmatically. A secondary purpose is to allow a third-party application to set the location of the user (latitude, longitude), even though this is less likely to be less useful to most applications.