Skip to content

Instantly share code, notes, and snippets.

View shamanNS's full-sized avatar

Predrag Đokić shamanNS

View GitHub Profile
@taoalpha
taoalpha / deleteKindleItems.js
Last active September 12, 2016 22:50
delete kindle items
// bulk deletion for kindle items
function deleteKindleItems() {
if ($('.contentListIcon_myx').length > 0) {
// select first 10
$('.contentListIcon_myx').map(function(i,v){ if (i < 10) {$(v).click()}else{return}});
// delete
$('#contentAction_delete_myx').click();
// yes to delete
@c-kick
c-kick / hnl.mobileConsole.js
Last active March 18, 2025 22:30
NOTE: V2 Released! Seehttps://github.com/c-kick/mobileConsole hnl.mobileConsole.js - extends JavaScript's console to display a visual console inside the webpage. Very usefull for debugging JS on mobile devices with no real console. Info and demo: http://www.hnldesign.nl/work/code/mobileconsole-javascript-console-for-mobile-devices/
/*!
*
* NEW VERSION AT https://github.com/c-kick/mobileConsole
*
* hnl.mobileConsole - javascript mobile console - v1.3.8 - 04/01/2021
* Adds html console to webpage. Especially useful for debugging JS on mobile devices.
* Supports 'log', 'trace', 'info', 'warn', 'error', 'group', 'groupEnd', 'table', 'assert', 'clear'
* Inspired by code by Jakub Fiala (https://gist.github.com/jakubfiala/8fe3461ab6508f46003d)
* Licensed under the MIT license
*
@rfletcher
rfletcher / lastfm-dedupe.js
Created February 16, 2016 14:39
Bookmarklet to remove duplicates from your Last.FM track list
/**
* Bookmarklet to remove duplicate entries from your Last.FM track list.
*
* Bookmarklet version:
* javascript:(%20function()%20{var%20row_to_title%20=%20function(%20$tr%20)%20{return%20$tr.find(%20%22.chartlist-name%20a:not(:empty)[title*=%E2%80%94]%22%20).attr(%20%22title%22%20).replace(%20/\s+/g,%20%27%20%27%20);};jQuery(%20%22table.chartlist%20>%20tbody%20>%20tr%22%20).each(%20function()%20{var%20$tr%20=%20jQuery(%20this%20),$siblings%20=%20jQuery(%20$tr.nextAll(%20%22tr%22%20).slice(%200,%206%20)%20),current_title%20=%20row_to_title(%20$tr%20);$siblings.each(%20function()%20{var%20$sibling%20=%20jQuery(%20this%20),sibling_title%20=%20row_to_title(%20$sibling%20);if(%20sibling_title%20!==%20%22%22%20&&%20current_title%20===%20sibling_title%20)%20{console.log(%20%22Removed%20%22%20+%20sibling_title%20);$sibling.find(%20%22.chartlist-delete%20form%20[type=submit]%22%20).click();return%20false;}});}%20);}()%20);
*
* Full version:
*/
( function() {
var row_to_title = function( $tr ) {
@nolanlawson
nolanlawson / protips.js
Last active November 19, 2024 02:40
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@adam-p
adam-p / Local PR test and merge.md
Last active April 1, 2025 20:23
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
# Node-WebKit CheatSheet
# Download: https://github.com/rogerwang/node-webkit#downloads
# Old Versions: https://github.com/rogerwang/node-webkit/wiki/Downloads-of-old-versions
# Wiki: https://github.com/rogerwang/node-webkit/wiki
# How: https://github.com/rogerwang/node-webkit/wiki/How-node.js-is-integrated-with-chromium
# 1. Run your application.
# https://github.com/rogerwang/node-webkit/wiki/How-to-run-apps