Skip to content

Instantly share code, notes, and snippets.

@gregilo
gregilo / pip.js
Created October 10, 2023 05:12
Picture in Picture Bookmarklet
javascript: (function() {
'use strict';
const videoEls = document.querySelectorAll('video');
videoEls.forEach((videoEl) => {
if (typeof videoEl.requestPictureInPicture === 'function') {
videoEl.requestPictureInPicture();
}
});
})();
@gregilo
gregilo / bandcamp_silent_lurk.js
Created October 31, 2022 15:00
Bandcamp Silent Lurk
// ==UserScript==
// @name Bandcamp Silent Lurk
// @namespace http://*.bandcamp.com/*
// @version 0.1
// @description I felt weird that Bandcamp notifies people when I buy stuff from the feed, so I think this disables that
// @author https://github.com/gregilo
// @match https://*.bandcamp.com/*
// @exclude https://bandcamp.com/download*
// @icon https://www.google.com/s2/favicons?sz=64&domain=bandcamp.com
// ==/UserScript==
@gregilo
gregilo / bandcamp_enhanced_feed_player.js
Last active October 31, 2022 14:59
Bandcamp Enhanced Feed Player
// ==UserScript==
// @name Bandcamp Feed Player
// @namespace http://bandcamp.com/
// @version 0.1
// @description Adds scrubbing, play/pause, and volume control to the player on the Bandcamp feed page
// @author https://github.com/gregilo
// @match https://bandcamp.com/*/feed*
// @icon https://www.google.com/s2/favicons?sz=64&domain=bandcamp.com
// @grant none
// ==/UserScript==
@gregilo
gregilo / googl_ifl_autoclick.js
Created March 14, 2020 23:11
Google IFL Auto-click
// ==UserScript==
// @name Google IFL Auto-click
// @namespace https://www.google.com
// @version 0.1
// @description Auto-click I'm feeling lucky link on redirect notice page
// @author gregilo
// @match https://www.google.com/url?q=*
// @grant none
// ==/UserScript==
@gregilo
gregilo / iterm2_mac_keybinds.md
Last active April 1, 2019 15:17
iTerm2 Mac Keybindings (for easier editing and cursor movement)

These keybindings make working with iTerm2 on a Mac much easier! Credit to https://stackoverflow.com/a/22312856 (@sqren)

Move cursor one word left

Keyboard Combination: +
Action: Send Hex Code
Code: 0x1b 0x62

Move cursor one word right

@gregilo
gregilo / twig.code-snippets
Last active December 17, 2018 17:29
Twig Code Snippets for VS Code
{
"Drupal dump": {
"scope": "twig",
"prefix": "dd",
"body": "{{ dd($1) }}"
},
"if": {
"scope": "twig",
"prefix": "if",
"body": [
@gregilo
gregilo / stop_youtube_channel_autoplay.js
Last active August 25, 2023 01:45
Stop YouTube Channel Featured Video Autoplay (TamperMonkey/Greasemonkey)
// ==UserScript==
// @name Stop YouTube Channel Autoplay
// @namespace https://github.com/gregilo
// @version 0.2
// @description Stop featured videos from autoplaying on YouTube Channel landing pages
// @author gregilo
// @match https://www.youtube.com/channel*
// @match https://www.youtube.com/user*
// @grant none
// ==/UserScript==
@gregilo
gregilo / php-snippets.cson
Created June 4, 2018 15:33
PHP Snippets for Atom
'.php':
'Var dump':
'prefix': 'var_dump'
'body': 'echo "<pre>";var_dump($1);echo "</pre>";$2'
'print_r':
'prefix': 'print_r'
'body': 'echo "<pre>";print_r($1);echo "</pre>";$2'
@gregilo
gregilo / .vimrc
Created May 22, 2018 02:41
.vimrc
filetype plugin indent on
syntax on
set term=xterm-256color
set mouse=a
@gregilo
gregilo / .gitconfig
Last active February 27, 2024 16:00
Git aliases for ~/.gitconfig
[alias]
delete = "!f(){ local branch_name=$1;git branch -d $branch_name && (git remote | xargs -L1 -I '{}' git push {} :$branch_name);};f" # delete a branch locally and from all remotes
rd = "!f(){ local branch_name=$1;(git remote | xargs -L1 -I '{}' git push {} :$branch_name);};f" # delete a branch from all remotes
pruneall = "!f(){ git remote | xargs -L1 git remote prune;};f" # prune all remotes
local-branches = !git branch -vv | cut -c 3- | awk '$3 !~/\\[/ { print $1 }' # list branches that exist locally but not in remotes
update = "!f(){ git fetch --all && git pruneall && git status; };f" # fetch and prune all remotes, then run `git status`
upull = !git update && git pull # fetch and prune all remotes (via update alias), then pull
plog = "log --color --graph --pretty=format:'%C(auto)%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit --date=relative" # prettier `git log`
branchdiff = !git diff --unified=1 main...HEAD # diff against main
lstash = !git stash list