Skip to content

Instantly share code, notes, and snippets.

View skjnldsv's full-sized avatar
🎯
Focusing

John Molakvoæ skjnldsv

🎯
Focusing
View GitHub Profile
@skjnldsv
skjnldsv / github-status-check-sort.user.js
Last active March 1, 2024 16:43
Github status check sort
// ==UserScript==
// @name Github status check sort
// @namespace https://github.com/
// @version 1.1.3
// @description Sort the status checks on a PR by status and then by name
// @author Skjnldsv
// @match https://github.com/*/*/pull/*
// @icon https://github.githubassets.com/favicons/favicon.svg
// @grant none
// @updateURL https://gist.github.com/skjnldsv/eb7b894ae996affde4a7d0e00e0d80a1/raw/github-status-check-sort.user.js

To be called with:

git diff --text --word-diff=porcelain | awk -v red="$(tput setaf 1)" -v green="$(tput setaf 2)" -v reset="$(tput sgr0)" -f ~/.dotfiles/scripts/worddiff.awk
@skjnldsv
skjnldsv / nextcloud-drone-status-sort.user.js
Last active July 24, 2023 09:41
Nextcloud drone status check sort
// ==UserScript==
// @name Nextcloud drone status check sort
// @namespace http://drone.nextcloud.com/
// @version 0.3
// @description Put Nextcloud drone failed jobs on top of the list
// @author MorrisJobke & Skjnldsv
// @match https://drone.nextcloud.com/nextcloud/*
// @icon https://github.githubassets.com/favicons/favicon.svg
// @grant none
// @updateURL https://gist.github.com/skjnldsv/d9244cf50d148d4e38319fe497f7b68c/raw/nextcloud-drone-status-sort.user.js
@bkeepers
bkeepers / .env
Last active November 2, 2020 17:32
Probot plugin that ensures every commit message has the word "bananas"
# The ID of your GitHub App
APP_ID=
WEBHOOK_SECRET=development
# Uncomment this to get verbose logging
# LOG_LEVEL=trace # or `info` to show less
# Go to https://smee.io/new set this to the URL that you are redirected to.
# WEBHOOK_PROXY_URL=
@ahem
ahem / loadimage.js
Created October 18, 2016 12:59
Load and decode images with webworker
/* global createImageBitmap */
function loadImageWithImageTag(src) {
return new Promise((resolve, reject) => {
const img = new Image;
img.crossOrigin = '';
img.src = src;
img.onload = () => { resolve(img); };
img.onerror = () => { reject(img); };
});
@NathanGiesbrecht
NathanGiesbrecht / noip2.service
Last active February 24, 2024 01:32
Systemd Service file for no-ip.com dynamic ip updater
# Simple No-ip.com Dynamic DNS Updater
#
# By Nathan Giesbrecht (http://nathangiesbrecht.com)
#
# 1) Install binary as described in no-ip.com's source file (assuming results in /usr/local/bin)
# 2) Run sudo /usr/local/bin/noip2 -C to generate configuration file
# 3) Copy this file noip2.service to /etc/systemd/system/
# 4) Execute `sudo systemctl daemon-reload`
# 5) Execute `sudo systemctl enable noip2`
# 6) Execute `sudo systemctl start noip2`
// this is the service worker which intercepts all http requests
self.addEventListener('fetch', function fetcher (event) {
var request = event.request;
// check if request
if (request.url.indexOf('assets.contentful.com') > -1) {
// contentful asset detected
event.respondWith(
caches.match(event.request).then(function(response) {
// return from cache, otherwise fetch from network
return response || fetch(request);
@MoOx
MoOx / index.js
Last active February 9, 2024 22:44
Export/import github labels
// go on you labels pages
// eg https://github.com/cssnext/cssnext/labels
// paste this script in your console
// copy the output and now you can import it using https://github.com/popomore/github-labels !
var labels = [];
[].slice.call(document.querySelectorAll(".label-link"))
.forEach(function(element) {
labels.push({
name: element.textContent.trim(),
# NPM CheatSheet.
# Super easy intall: npm comes with node now.
# To create your own npm package: https://www.npmjs.org/doc/misc/npm-developers.html
# More: https://www.npmjs.org/doc/
# 1. NPM Command Lines.
# Local mode is the default.
# Use --global or -g on any command to operate in global mode instead.
@ohaal
ohaal / find_relative_path.func.php
Created June 15, 2012 11:47
Find the relative path between two paths
/**
*
* Find the relative file system path between two file system paths
*
* @param string $frompath Path to start from
* @param string $topath Path we want to end up in
*
* @return string Path leading from $frompath to $topath
*/
function find_relative_path ( $frompath, $topath ) {