Skip to content

Instantly share code, notes, and snippets.

@nijotz
nijotz / syntax.js
Last active May 22, 2020 17:07
Screw it, we're re-writing it in Rust
/* * * * * * * * * * * * * * * * * * * * * *
* First try
*/
let {skip, secret} = getTestSecret('LICENSE')
tap.test('first test', {skip}, (t) => {
//...
})
// Doesn't like the leading brace, thinks it's a code block
{skip, secret} = getTestSecret('OTHER_LICENSE')
@nijotz
nijotz / gist:716b99b8d28d03cf5f2e3e80adfd3a34
Last active June 3, 2021 20:32
Block YouTube recommendations at the end of the video and on the side
! 7/4/2019 https://www.youtube.com
www.youtube.com##ytd-compact-video-renderer > #dismissible
www.youtube.com##ytd-compact-radio-renderer > #dismissible
www.youtube.com##ytd-compact-movie-renderer > #dismissible
www.youtube.com##.ytp-endscreen-content
// cleaner output, but same results without
const Promise = require('bluebird');
// What is the best way to run async functions
// * in parallel
// * fail fast
// * not have unhandled promises
// * single failure path (try/catch)
// ?
function sleepReject(time, msg) {
return new Promise((resolve, reject) => {
setTimeout(() => reject(msg || 'reject'), time);
});
}
async function test() {
try {
let valuePromises1 = [1000, 2000, 3000].map(x => sleepReject(x));
let valuePromises2 = [4000, 5000].map(x => sleepReject(x));
function sleepReject(time, msg) {
return new Promise((resolve, reject) => {
setTimeout(() => reject(msg || 'reject'), time);
});
}
async function test() {
try {
let valuePromises1 = [1000, 2000, 3000].map(x => sleepReject(x));
function sleepReject(time, msg) {
return new Promise((resolve, reject) => {
setTimeout(() => reject(msg || 'reject'), time);
});
}
async function test() {
try {
let valuePromises1 = [1000, 2000, 3000].map(x => sleepReject(x));
let valuePromises2 = [4000, 5000].map(x => sleepReject(x));
async function test() {
var p1 = new Promise((resolve, reject) => {
setTimeout(() => reject('one'), 1000);
});
var p2 = new Promise((resolve, reject) => {
setTimeout(() => reject('two'), 2000);
});
var p3 = new Promise((resolve, reject) => {
setTimeout(() => reject('three'), 3000);
});
@nijotz
nijotz / ublockfilter.txt
Created July 10, 2019 16:55
purge temptations from youtube
! 7/1/2019 https://www.youtube.com
www.youtube.com###dismissable
www.youtube.com##.ytp-endscreen-content
www.youtube.com##ytd-compact-playlist-renderer.ytd-watch-next-secondary-results-renderer.style-scope
www.youtube.com##.use-ellipsis.ytd-watch-next-secondary-results-renderer.style-scope
python: stdout/stderr (slack): Traceback (most recent call last):
python: stdout/stderr (slack): File "/home/nick/.weechat/python/wee_slack.py", line 133, in wrapper
python: stdout/stderr (slack): return f(data, current_buffer, *args, **kwargs)
python: stdout/stderr (slack): File "/home/nick/.weechat/python/wee_slack.py", line 144, in wrapper
python: stdout/stderr (slack): return f(*decode_from_utf8(args), **decode_from_utf8(kwargs))
python: stdout/stderr (slack): File "/home/nick/.weechat/python/wee_slack.py", line 3868, in command_thread
python: stdout/stderr (slack): msg = get_msg_from_id(channel, args)
python: stdout/stderr (slack): File "/home/nick/.weechat/python/wee_slack.py", line 3854, in get_msg_from_id
python: stdout/stderr (slack): return channel.hashed_messages.get(msg_id)
python: stdout/stderr (slack): AttributeError: 'SlackTeam' object has no attribute 'hashed_messages'
@nijotz
nijotz / DiscoStrobe.ino
Created August 13, 2016 06:03 — forked from kriegsman/DiscoStrobe.ino
DiscoStrobe - Flashing rainbow lights that zoom back and forth to a beat
#include "FastLED.h"
// DiscoStrobe
// *Flashing* rainbow lights that zoom back and forth to a beat.
// See your doctor before using this code if you have certain neurological conditions.
//
// Mark Kriegsman, July 2015
#if FASTLED_VERSION < 3001000