Skip to content

Instantly share code, notes, and snippets.

View joshuatz's full-sized avatar

Joshua Tzucker joshuatz

View GitHub Profile
@PaulKinlan
PaulKinlan / monitorEvents.js
Created October 14, 2016 07:38
monitorEvents.js
function monitorEvents(element) {
var log = function(e) { console.log(e);};
var events = [];
for(var i in element) {
if(i.startsWith("on")) events.push(i.substr(2));
}
events.forEach(function(eventName) {
element.addEventListener(eventName, log);
});
@axelpale
axelpale / combinations.js
Last active July 7, 2023 10:37
JavaScript functions to calculate combinations of elements in Array.
/**
* Copyright 2012 Akseli Palén.
* Created 2012-07-15.
* Licensed under the MIT license.
*
* <license>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
@jcarbaugh
jcarbaugh / discover.py
Created September 30, 2015 17:33
DIAL examples
import httplib
import socket
import StringIO
# generic
SSDP_ALL = 'ssdp:all'
UPNP_ROOT = 'upnp:rootdevice'
# devices
DIAL = 'urn:dial-multiscreen-org:service:dial:1'
@thaJeztah
thaJeztah / docker-examples.md
Last active January 14, 2024 02:00
Some docker examples

Commit, clone a container

To 'clone' a container, you'll have to make an image of that container first, you can do so by "committing" the container. Docker will (by default) pause all processes running in the container during commit to preserve data-consistency.

For example;

docker commit --message="Snapshot of my container" my_container my_container_snapshot:yymmdd
@zkat
zkat / index.js
Last active March 10, 2024 14:32
npx is cool
#!/usr/bin/env node
console.log('yay gist')
@CMCDragonkai
CMCDragonkai / ways_of_piping_and_redirection.sh
Last active March 12, 2024 11:06
BASH: Ways of Piping/Redirection and Heredoc Demonstration
# shells are an orchestration environment
# the language they provide is intended to orchestrate processes
# on the operating system
# if programs are functions, then all of the below are variants of function application
# anonymous pipe
echo "string" | cat
# herestring
cat <<< "string"
@nolanlawson
nolanlawson / offline-first-tools.md
Last active March 16, 2024 15:46
List of offline-first tools for web developers

Offline-first tools for web developers

A quick list of tools for building HTML/CSS/JS apps that work well offline. Ping me at @nolanlawson if I missed anything!

Hybrid app development

Tools for bundling your HTML/CSS/JS into a native app.

@peltho
peltho / svelte.md
Last active April 2, 2024 07:43
Svelte cheatsheet
@miketromba
miketromba / deleteYoutubeWatchHistory.js
Last active April 13, 2024 18:02
Delete YouTube watch history with filter
const ENABLED = false // Keep this false while testing to verify that it's working correctly
const DELETE_INTERVAL = 1000 // Amount of time in MS to wait between deletion (more likely to fail with a small number)
// This filter should return a boolean (true == delete video, false == keep video)
const MIN_DURATION_MS = 1000 * 60 * 1.5 // 1:30 mins
const SHOULD_DELETE = videoElement => {
try {
// Get the duration string