Skip to content

Instantly share code, notes, and snippets.

(function (turntable) {
const modal = `
<div class='playlistFeatures'>
<p>Deep-Cut to Queup exporter</p>
<button type="button" class='exportPlaylist'>Export Playlist: <span id="exporting-playlist"></span></button>
<hr />
<p>Experimental: Export all playlists at once</p>
<p>Warning: this can be slow and will lock up the UI while processing, do not do this if you are DJ-ing</p>
<button type="button" class='exportPlaylistAll'>Export All Playlists</button>
<div id="pluginTT-loading">
@FranciscoG
FranciscoG / deno-check-permissions.md
Last active April 8, 2023 16:12
A small Deno script that enforces some stricter security in your project

Place this script at the very top of your entry file so that you can enfore that you are always using an allow-list for each of the permission flags deno provides.

it will exit with error code 1 if:

  • you use --allow-all
  • if you use any flag without providing a list: --allow-write instead of --allow-write=./tmp
  • you use --allow-hrtime

hrtime - This one does not use a list but I've included it because Deno's documentation states that "High-resolution time can be used in timing attacks and fingerprinting".

This script was written for Deno's permissions as of version v1.32.3.

@FranciscoG
FranciscoG / FetchError.ts
Last active March 28, 2023 02:58
Wrapping native Fetch to make it mimic Axios
/**
* An extended Error similar to Axios where it includes some of the response information in the error object
* Response type info: https://developer.mozilla.org/en-US/docs/Web/API/Response
*/
export class FetchError extends Error {
response: {
status: Response["status"];
statusText: Response["statusText"];
headers: Response["headers"];
type: Response["type"];
// create a new bookmark and paste this into the url
javascript:(function(){window.location.href=window.location.href.replace('//www.reddit','//old.reddit')})();
@FranciscoG
FranciscoG / README.md
Last active August 30, 2022 18:35
Hacker News - open both links at the same time

This snippet inserts a button into the row of actionable links under each submission that allows a user to open both the submission and the comments in one click

WARNING

Since this opens up 2 tabs from one click, you'll need to grant the site popup permissions.

@FranciscoG
FranciscoG / README.md
Last active May 20, 2022 17:23
Turntable.fm resize chat

Turntable.fm resize chat

If you just want to set the size once, you can use the CSS file below and change the values to your preference. You can use the turnStyles extension to insert the CSS

If you want to be able to resize the chat panel width and font size, use the JS file below and copy paste it into the inspector console

view demo

of add a bookmark with the following js code:

@FranciscoG
FranciscoG / custom-keys-directive.js
Last active May 28, 2020 21:05
Vue custom directive that only allows certain keys to be typed into an element that accepts keyboard input
/**
* `v-kesAllowed` directive
*
* This works by blocking keys during onKeyDown by using a whitelist regex and
* testing `event.key`
*/
/**
* these keys should be allowed in all cases because they handle traversing and a11y
*/
@FranciscoG
FranciscoG / adbrecord.sh
Last active December 13, 2019 19:52
Using adb to create screen recordings of all plugged in Android devices
#!/bin/bash
# TODO:
# - add option to change the time limit
# - add option to change the output folder
# - add option to delete recordings on device once they have been pulled
# - figure out how to kill script when everything is done
# how many seconds to record for
LIMIT=5
@FranciscoG
FranciscoG / convert.sh
Last active January 17, 2024 16:04
Convert Video to Image sequence using ffmpeg
ffmpeg -i input.mov -r 0.25 output_%04d.png
# -i followed by video file sets input stream
# -r set framerat. 1 = 1 frame per second.
# and then set the output file with the number replacement
# more info: https://ffmpeg.org/ffmpeg.html#Main-options
# https://superuser.com/questions/135117/how-to-convert-video-to-images
@FranciscoG
FranciscoG / scrollIt.js
Created November 6, 2018 18:57
Vanilla JS scroll window to an element
/**
* Source: https://pawelgrzybek.com/page-scroll-in-vanilla-javascript/
*/
function scrollIt(destination, duration = 200, easing = 'linear', callback) {
const easings = {
linear(t) {
return t;
},