Skip to content

Instantly share code, notes, and snippets.

View magasine's full-sized avatar

Manoel Garcia da Silveira Neto magasine

View GitHub Profile
@jareha
jareha / bookmarklet_localhost-toggler.js
Last active September 19, 2022 03:18
Bookmarklet to toggle between `localhost` and production
/* jshint esversion: 8 */
(function () {
const domain = "https://example.com";
const isLocalhost = window.location.href.indexOf("localhost") >= 0;
const localhost = "http://localhost:8080";
const pathname = window.location.pathname;
const url = isLocalhost ? (domain + pathname) : (localhost + pathname);
window.location = url;
})();
@dineshdeveloper1
dineshdeveloper1 / pageleavingevent.js
Created January 6, 2022 09:54
Event Listener - when leaving page
// How to detect when mouse pointer leaves viewport
document.addEventListener("mouseleave", function(e){
if( e.clientY < 0 )
{
alert("Hey don't leave. we have some offer for you");
}
}, false);
//for more detail- http://qnimate.com/exit-intent-using-javascript
@kepano
kepano / obsidian-web-clipper.js
Last active July 21, 2025 04:15
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/[email protected]?module'), import('https://unpkg.com/@tehshrike/[email protected]'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@ltpitt
ltpitt / autoScroller.js
Last active September 1, 2022 01:01
A simple auto scroller button, can be pasted in browser console or injected in other ways in any website
// Simply copy and paste the following script in your browser's console,
// it will add an auto-scrolling button on the right part of the webpage you are visiting.
(function() {
let cssScrolling = "background-color: #f44336; border: none; color: white; padding: 15px 32px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; float:right; position:fixed; right:0; top:50%;";
let cssStopped = "background-color: #4CAF50; border: none; color: white; padding: 15px 32px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; float:right; position:fixed; right:0; top:50%;";
let btn = document.createElement("button");
var isScrolling = false;
btn.innerHTML = "start scroll";
btn.style.cssText = cssStopped;
@mvark
mvark / IPLookup.js
Created May 6, 2021 10:08
Bookmarklet that calls a REST API to fetch geolocation details for a given IP address
//IP LOCATION TRACKER BOOKMARKLET
//Original source: https://funbutlearn.com/2016/06/ip-location-tracker-bookmarklet-created.html
//modified API service from http://ip-api.com which doesn't support HTTPS to https://ipapi.co/ to have a secure endpoint & avoid Mixed Content blocking issue
javascript: (function() {
var text = "";
if (window.getSelection) {
text = window.getSelection().toString();
} else if (document.selection && document.selection.type != "Control") {
text = document.selection.createRange().text;
}
@anonymous1184
anonymous1184 / ClipHistory.ahk
Last active August 12, 2024 01:56
Clipboard History Manager

; Version: 2022.06.30.1
; Usages and examples: https://redd.it/mq9m58
ClipHistory(Ini, Monitoring := true)
{
static instance := false
if (!instance)
instance := new ClipHistory(Ini, Monitoring)
@blrop
blrop / save-load-scroll.js
Created October 25, 2020 21:26
Save Scroll / Load Scroll bookmarklets
// save scroll
javascript:(function(d, scrT){var lsKey = 'bmk_scroll_' + d.location.href,scrollPos = d.documentElement.scrollTop || d.body.scrollTop;localStorage[lsKey] = scrollPos;})(document)
// load scroll
javascript:(function(d, scrT){var lsKey = 'bmk_scroll_' + d.location.href;if(!localStorage[lsKey]){return}scrollTo(0, localStorage[lsKey]);})(document)
/*
How to use:
1. Open Chrome
2. New Bookmark
3. Enter Name - https://emojipedia.org/search/?q=calendar
4. Paste code below into URL field
*/
javascript: (function() {
var title = encodeURIComponent("Follow Up - " + document.title.replace("Account > ",""));
function PRECO_BOVESPA(ticker) {
var todayDate = new Date().toISOString().slice(0,10);
var url = "https://arquivos.b3.com.br/apinegocios/ticker/" + ticker + "/" + todayDate;
var json = JSON.parse(UrlFetchApp.fetch(url).getContentText());
var price = json.values[0][2];
return price;
}
@yrtimiD
yrtimiD / Always-On-Top-AutoHotkey.ahk
Created May 23, 2020 18:17
Windows Always on Top AutoHotkey
Menu,Tray,Tip,Always on top`nWin+Space to toggle always on top
SendMode, Input
;#SPACE:: Winset, Alwaysontop, , A
#SPACE::
WinGetActiveTitle, t
WinGet, ExStyle, ExStyle, %t%
if (ExStyle & 0x8)