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
// couldn't get scraper to get the data so I just used console | |
// easy to tweak for your own codepen page | |
// get data from console in 'https://codepen.io/Fraasi/pens/public/?grid_type=list'; | |
// var aNodes = document.querySelectorAll('tr > td.title a') | |
// var pens = {}; | |
// aNodes.forEach( a => { pens[a.innerText] = a.href; }) | |
// copy(pens) | |
var pens = { | |
"D3 zoomable-draggable datapoint map":"https://codepen.io/Fraasi/pen/zwgdyV", |
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
function msToTime(duration) { | |
// from https://stackoverflow.com/questions/19700283/how-to-convert-time-milliseconds-to-hours-min-sec-format-in-javascript | |
var milliseconds = parseInt((duration%1000)/100) | |
, seconds = parseInt((duration/1000)%60) | |
, minutes = parseInt((duration/(1000*60))%60) | |
, hours = parseInt((duration/(1000*60*60))%24); | |
hours = (hours < 10) ? "0" + hours : hours; | |
minutes = (minutes < 10) ? "0" + minutes : minutes; | |
seconds = (seconds < 10) ? "0" + seconds : seconds; | |
return hours + ":" + minutes + ":" + seconds + "." + milliseconds; |
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
// ==UserScript== | |
// @name Youtube playlist link fix & prevent autoplays | |
// @namespace http://tampermonkey.net/ | |
// @version 0.2.0 | |
// @description Change playlist title link to playlist page instead of first item in playlist & prevent autoplays | |
// @author Fraasi | |
// @match https://www.youtube.com/* | |
// @run-at document-end | |
// @grant none | |
// ==/UserScript== |
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
function reOrganizeQuotes(quotes) { | |
// from { quote: author} | |
// to { author: [quote] } | |
const newObj = {} | |
Object.entries(quotes).forEach(([key, value]) => { | |
newObj[value] === undefined ? | |
newObj[value] = [key] : | |
newObj[value].push(key) |
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
Array.prototype.myMap = function (callback, thisArg) { | |
if (!thisArg) thisArg = this | |
if (!Array.isArray(thisArg)) throw new Error('Not an Array') | |
if (typeof callback !== 'function') throw new Error('Callback must be a function') | |
const newArray = [] | |
for (let i = 0; i < thisArg.length; i++) { | |
newArray.push(callback(thisArg[i], i, thisArg)) | |
} | |
return newArray | |
} |
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
iFrames = [] | |
iFramesInner = [] | |
filterOut = [ // does not work with YT-DL | |
"mycloud", | |
"vidzi", | |
"vidbull", | |
"fmoviesfree", | |
"vidcloud", | |
"streamcherry", | |
"vidup", |
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
function resizeWindow() { | |
const padding = 20 // title bar height without menu in electron | |
const heightDiff = (document.body.clientHeight - document.documentElement.clientHeight) + padding | |
window.resizeBy(0, heightDiff) | |
} |
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
(function () { | |
if (window.location.host !== 'github.com') { | |
alert('Not a GitHub page.'); | |
return; | |
} | |
if (window.location.pathname.split('/').length < 3) { | |
alert('Not in a repository page.'); | |
return; | |
} | |
function formatBytes(a, b) { if (0 == a) return "0 Bytes"; var c = 1024, d = b || 2, e = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], f = Math.floor(Math.log(a) / Math.log(c)); return parseFloat((a / Math.pow(c, f)).toFixed(d)) + " " + e[f] } |
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 path = require('path') | |
const fs = require('fs') | |
let folderCount = 0 | |
let stdoutWidth = process.stdout.columns - 9 | |
let startTime | |
const results = {} | |
function checkChallenges(startDir) { | |
startTime = new Date() |
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
#!/bin/bash | |
declare -a MODES | |
MODES=("b" "d" "g" "p" "s" "t" "w" "y") | |
declare -a COWS | |
COWS=("tableflip" "aperture-blank" "beavis.zen" "bees" "biohazard" "box" "broken-heart" "cat" "cat2" "clippy" "cowfee" "cube" "default" "dragon" "hedgehog" "kilroy" "kosh" "nyan" "owl" "psychiatrichelp" "psychiatrichelp2" "shrug" "squirrel" "tux") | |
MODES_LENGTH=${#MODES[@]} | |
MODES_INDEX=$(($RANDOM % $MODES_LENGTH)) |
OlderNewer