Skip to content

Instantly share code, notes, and snippets.

@thomasmb
thomasmb / script.js
Created June 16, 2021 13:50
A JS snippet you can run on the Digital Ocean notification page to read all notifications. Start it off by running the start_processing() function
var interval;
function start_processing(){
interval = setInterval( open_notifications, 1000 );
}
function open_notifications(){
let notifications = document.querySelectorAll('.notification-listing .notification-row:not(.acknowledged) .action');
if( !notifications.length ) {
@thomasmb
thomasmb / jquery-resize-event.js
Last active June 11, 2022 16:04
jQuery resizestart and resizeend events
var resizeTimer = false;
$(window).on('resize', function(e) {
if( !resizeTimer ) {
$(window).trigger('resizestart');
}
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
@thomasmb
thomasmb / mysql_pwd_reset.sh
Created August 12, 2014 20:55
A shell script for resetting the root MySQL password
# Please confirm that you want to reset the MySQL passwords
CONFIRM="n"
echo -n "Please confirm MySQL password reset. Continue? (y/N): "
read -n 1 CONFIRM_INPUT
if [ -n "$CONFIRM_INPUT" ]; then
CONFIRM=$CONFIRM_INPUT
fi
echo
@thomasmb
thomasmb / ajax-gist-embed.js
Created October 24, 2013 07:09
Loading gist embeds dynamically
// … find all gist scripts inside the ajax container
var $gists = $ajax_container.find('script[src^="https://gist.github.com/"]');
// if gist embeds are found
if( $gists.length ){
// update each gist
$gists.each(function(){
// we need to store $this for the callback