Skip to content

Instantly share code, notes, and snippets.

View apricot13's full-sized avatar

Han apricot13

View GitHub Profile
@apricot13
apricot13 / highlight shorts + premiers + lives.js
Last active March 18, 2022 12:56
Highlight short videos on youtube (bookmarklet)
javascript:const milliseconds=(e,t,r)=>1e3*(60*e*60+60*t+r),times=document.querySelectorAll("ytd-thumbnail-overlay-time-status-renderer");[...times].forEach(e=>{const t=e.querySelector("#text").innerHTML.trim().split(":");2===t.length&&t.unshift("0");const r=milliseconds(t[0],t[1],t[2]);r<=6e4&&(e.closest("ytd-grid-video-renderer").style.backgroundColor="#a57070"),isNaN(r)&&(e.closest("ytd-grid-video-renderer").style.backgroundColor="#6e6ebb")});
@apricot13
apricot13 / sortByActualPrice-bookmarklet.js
Last active January 4, 2022 15:11
Amazon wishlist Sort by Price Dropped By Bookmark (copy paste this entire thing into the URL part of a bookmark in chrome)
javascript:const allItems=document.getElementById("g-items");allItems.style.display="flex",allItems.style.flexDirection="column",allItems.style.flexFlow="column-reverse";const items=allItems.querySelectorAll("li"),prices=[];[...items].forEach(e=>{let t=e.getAttribute("data-price");e=e.getAttribute("data-itemid");t=isFinite(t)&&!isNaN(t)?t:0,prices.push([e,t])}),prices.sort((e,t)=>t[1]-e[1]),prices.forEach((e,t)=>{if(""!==e[0]){e='[data-itemid="'+e[0]+'"]';console.log(e);const l=document.querySelector(e);console.log(e,l),l&&(l.style.order=t)}});
<!-- Step 1 - we need people to be able to choose their image -->
<div class="test-image">
<input type="file" id="testImage" onchange="onFileSelected(event)" />
</div>
@apricot13
apricot13 / gist:26d7142333c78cc4bdbe2e2da00c59cd
Created August 24, 2020 15:41
Copy trello board as markdown
http://www.secretgeek.net/trello_ws
```js
var s = [];
s.push("# " + jQuery(".board-header").children()[0].innerText);
jQuery(".list:has(.list-header-name)").each(function() {
s.push("\n## " + jQuery(this).find(".list-header-name-assist")[0].innerText + "\n");
jQuery(this).find(".list-card").each(function() {
var lne = "* " + jQuery(this).find(".list-card-title")[0].innerText
<!doctype html>
<html class="no-js" lang="en-gb">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</script>
#documentView {
font-family: Open Sans
}
.page {
width: 90% !important;
margin: 0px auto;
transform: none !important;
}
.name {
padding-bottom: 5px !important;
@apricot13
apricot13 / folderwatch.md
Last active August 29, 2015 14:20
Applescript: Watch folder and update labels
-- I want edited folders to be red.
	property red : 2
    on adding folder items to this_folder after receiving added_items
         try
              tell application "Finder"
          -- set label of the 'watched' folder to red
                   set label index of this_folder to red

-- for the items added

@apricot13
apricot13 / popup.html
Created May 9, 2015 11:35
Google Maps: popup map Uses fancybox http://fancybox.net/ (not fancybox 2)
<a id="popupmap" href="popuplocationmap.html"><img src="map.png" width="31" height="33" class="contactMap"/></a>
@apricot13
apricot13 / git_feature_branch
Created January 8, 2015 12:33
Git: Feature branch workflow
git checkout -b feature-branch master
git status
git add <some-file>
git commit
git push -u origin feature-branch
git push
git checkout master
@apricot13
apricot13 / Nicely-formatted-git.md
Last active July 13, 2016 19:31
Nicely formatted git

git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit

alias

git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

And every time you need to see your log, just type in git lg