Usage:
- Use code below and create a bookmarklet here: https://mrcoles.com/bookmarklet/
- Drag bookmarklet to Chrome bookmarks toolbar
- Navigate to 'https://www.facebook.com/ads/preferences'
const pagingInterval = setInterval(() => {| (function() { | |
| sessionStorage.clear(); | |
| const targetNode = document.querySelector('.unredeemed-keys-table'); | |
| if (!targetNode) { | |
| return; | |
| } | |
| const config = { attributes: true, childList: true, subtree: true }; | |
| const steamRegex = /\S{5}-\S{5}-\S{5}(-\S{5}-\S{5})?/; | |
| const extract = (mutationsList, observer) => { |
| # from: https://github.com/stedolan/jq/issues/104 | |
| # more explicit (per value) | |
| walk( | |
| if type == "object" then | |
| with_entries( | |
| select( | |
| .value != null and | |
| .value != "" and | |
| .value != [] and |
| # ported from https://github.com/junegunn/fzf/wiki/examples#git | |
| function glog --description 'git log + fzf + delta => returns git_sha' | |
| set -lx git_dir (git rev-parse --git-dir 2> /dev/null) | |
| if test -n "$git_dir" | |
| set -l EXTRACTED_SHA "echo {} | head -1 | cut -d' ' -f1" | |
| set -l VIEW_LINE "$EXTRACTED_SHA | xargs -I % sh -c 'git show --color=always % | delta'" | |
| set -l FORMAT "%C(auto)%h%d %s %C(black)%C(bold)%cr% C(auto)%aE" | |
| set -l commit_sha (git log --color=always --format="$FORMAT" $argv \ | |
| | fzf --no-sort --reverse --tiebreak=index --no-multi --ansi --preview="$VIEW_LINE" \ | |
| | cut -d' ' -f1) |
| #!/usr/bin/env bash | |
| # derived from https://github.com/junegunn/fzf/wiki/examples#git | |
| glog() { | |
| # extra sha from git log | |
| local parse_log="echo {} | grep -o '[a-f0-9]\{7\}' | head -1" | |
| # pass log line into colorized diff `delta` | |
| # https://github.com/dandavison/delta | |
| local view_line="$parse_log | xargs -I % sh -c 'git show --color=always % | delta'" |
| #!/usr/bin/env python | |
| import git | |
| import logging | |
| import os | |
| import re | |
| import sys | |
| from collections import Counter | |
| from prettytable import PrettyTable |
| #!/usr/bin/env bash | |
| MIN_LEVEL=0 | |
| MAX_LEVEL=100 | |
| if [ "$#" -eq 0 ]; then | |
| LEVEL=$MAX_LEVEL | |
| else | |
| LEVEL=$1 | |
| fi |
| #!/bin/sh | |
| # iterm_open_with - open a URL, file from CWD, full path, or path with linenumber in default app or Sublime Text if text file | |
| # For usage with iTerm2: | |
| # In iTerm's Preferences > Profiles > Default > Advanced > Semantic History, | |
| # choose "Run command..." and enter "/your/path/to/iterm_open_with \5 \1 \2". | |
| # Usage: iterm_open_with $(pwd) filename [linenumber] | |
| # $(pwd) = current working directory (either use `pwd` or $PWD) | |
| # filename = filename to open | |
| # lineno = line number | |
| pwd=$1 |
| #!/usr/bin/env python3 | |
| import math | |
| from prettytable import PrettyTable | |
| def main(): | |
| params = { | |
| 'amount': 12.34, | |
| 'split': 1 |
| $asArray = selector => Array.from(document.querySelectorAll(selector)); | |
| loadMore = setInterval(() => { | |
| const clickButton = ($x, index) => setTimeout(() => $x.click(), index * 25); | |
| const $more = $asArray('.load-more'); | |
| if ($more.length) { | |
| $more.forEach(clickButton); | |
| return; | |
| } | |
| clearInterval(loadMore); | |
| $asArray('.grid-coupon-btn').forEach(clickButton); |
Usage:
const pagingInterval = setInterval(() => {