Skip to content

Instantly share code, notes, and snippets.

Nik Zap nijotz

Block or report user

Report or block nijotz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View promises.js
// 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)
// ?
View lol-promises.js
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));
View promises.js
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));
View promises.js
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));
View promises.js
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 Jul 10, 2019
purge temptations from youtube
View ublockfilter.txt
! 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
View gist:145784abbd0b58ae5d7efa94f1aae087
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 Aug 13, 2016 — forked from kriegsman/DiscoStrobe.ino
DiscoStrobe - Flashing rainbow lights that zoom back and forth to a beat
View DiscoStrobe.ino
#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
View gist:b4684afe1ca416ca3d16af027ea43279
egrep -B10 '\s*nijotz.*(lol|hah)' irc.freenode.#infoforcefeed.weechatlog
@nijotz
nijotz / lolbow.txt
Created Jun 9, 2016
LOLBOW winners
View lolbow.txt
[4800x0C:07:19nick@nijotz~/.weechat/logs]$ grep -B1 LOLBOW irc.freenode.#infoforcefeed.weechatlog | grep -Ev '(LOLBOW|--)' | awk '{print $3}' | sort | uniq -c | sort -nr
24 cblgh
17 nijotz
17 jnerula
14 Pilate
12 trinque
11 vhost-
11 uptime
11 ben_vulpes
9 lykkin
You can’t perform that action at this time.