Skip to content

Instantly share code, notes, and snippets.

@troyhunt
troyhunt / rick-roll-content-scraper.js
Created August 19, 2020 07:41
A Cloudflare worker to redirect image requests from dickhead content scraper's site to a Rick Roll
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
async function fetchAndApply(request) {
let response = await fetch(request)
let referer = request.headers.get('Referer')
let contentType = response.headers.get('Content-Type') || ''
if (referer && contentType.startsWith('image/')) {
@ipatalas
ipatalas / commit-message.js
Last active May 1, 2024 21:09
Azure DevOps bookmarklets
var header = $('.grid-header');
var itemName = "";
var itemId = undefined;
var type = undefined;
if ($('.work-item-form-id').length == 1) {
itemId = $('.work-item-form-id').text();
itemName = $('.work-item-form-title input').val();
type = $('.work-item-type-icon-host').find('i').attr('aria-label');
} else {
@NickCraver
NickCraver / DmpAnalysis.linq
Last active May 1, 2024 21:09
DMP Analysis in LinqPad
<Query Kind="Program">
<NuGetReference Prerelease="true">Microsoft.Diagnostics.Runtime</NuGetReference>
<Namespace>Microsoft.Diagnostics.Runtime</Namespace>
<Namespace>System</Namespace>
<Namespace>System.IO</Namespace>
<Namespace>System.Linq</Namespace>
<Namespace>System.Text</Namespace>
<Namespace>Microsoft.Diagnostics.Runtime.Utilities</Namespace>
</Query>
@ipatalas
ipatalas / DmpAnalysis.linq
Created May 11, 2020 10:34 — forked from NickCraver/DmpAnalysis.linq
DMP Analysis in LinqPad
<Query Kind="Program">
<NuGetReference Prerelease="true">Microsoft.Diagnostics.Runtime</NuGetReference>
<Namespace>Microsoft.Diagnostics.Runtime</Namespace>
<Namespace>System</Namespace>
<Namespace>System.IO</Namespace>
<Namespace>System.Linq</Namespace>
<Namespace>System.Text</Namespace>
<Namespace>Microsoft.Diagnostics.Runtime.Utilities</Namespace>
</Query>
@ipatalas
ipatalas / Copy JIRA ID.js
Last active May 1, 2024 21:09
JIRA bookmarklets
let urlParams = new URLSearchParams(location.search);
let fromUrl = /\/browse\/(.*)/.exec(location.pathname);
let jiraId;
if (urlParams.has('selectedIssue')) {
jiraId = urlParams.get('selectedIssue');
} else if (fromUrl) {
jiraId = fromUrl[1];
}
@ipatalas
ipatalas / readme.txt
Created November 28, 2019 12:01
Chrome
Regex to filter out most meaningless requests in the Network tab:
/(?<!\.(css|js|gif|png|ico|ttf|woff2?))$/
@slzdevsnp
slzdevsnp / chrome_readme.md
Last active May 1, 2024 21:08
[chrome] #google #chrome #cloud #software

Restore chrome bookmarks

in Chrome goto Link

Find the for for Profile Path

on OSX the parent folder is ~/Library/Application Support/Google/Chrome/

Find in other profile folders the Bookmarks or Bookmarks.stored copy of your stored bookmarks file

@cou929
cou929 / detect-private-browsing.js
Last active May 1, 2024 21:07
Detect private browsing mode (InPrivate Browsing or Incognito).
function retry(isDone, next) {
var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false;
var id = window.setInterval(
function() {
if (isDone()) {
window.clearInterval(id);
next(is_timeout);
}
if (current_trial++ > max_retry) {
window.clearInterval(id);
@dgp
dgp / detect-private-browsing.js
Created April 12, 2016 12:14 — forked from cou929/detect-private-browsing.js
Detect private browsing mode (InPrivate Browsing or Incognito).
function retry(isDone, next) {
var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false;
var id = window.setInterval(
function() {
if (isDone()) {
window.clearInterval(id);
next(is_timeout);
}
if (current_trial++ > max_retry) {
window.clearInterval(id);
@dgeibi
dgeibi / async.js
Created November 26, 2017 08:26
async promise timer
async function async1() {
console.log('async 1')
await async2()
await async3()
console.log('async 1-1')
}
async function async2() {
console.log('async 2')
}