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)}});
@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
<!-- 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>
@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

#documentView {
font-family: Open Sans
}
.page {
width: 90% !important;
margin: 0px auto;
transform: none !important;
}
.name {
padding-bottom: 5px !important;
@apricot13
apricot13 / UserScript: Quick link to Flickr Url and HTML code for images.js
Last active December 21, 2015 16:39
I've always preferred sourcing my (as in my own) blog post images from the flickr website rather than use a plugin. This is a very basic user script that puts the url of the image you want in the image thumbnail as your browsing the site, it makes it much quicker to open them all in new tabs then copy them over to your blog post.
@apricot13
apricot13 / folderHasNewContent.scpt
Created March 28, 2013 13:48
An applescript to monitor a folder and add a red label to any new files/folders added.
-- 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"