Skip to content

Instantly share code, notes, and snippets.

View sscotth's full-sized avatar
🏠
𝄆 🍽 🛌 👨‍💻 𝄇

Scott Humphries sscotth

🏠
𝄆 🍽 🛌 👨‍💻 𝄇
View GitHub Profile
@sscotth
sscotth / objectmap.js
Created September 18, 2019 15:51
JS Object.map
const obj = { foo: 'hello', bar: 'world' }
const updatedObj = Object.fromEntries(
Object.entries(obj).map(([key, val]) => [
key,
val.toUpperCase(),
]),
)
// {foo: "HELLO", bar: "WORLD"}
import QtQuick 2.0
import MuseScore 3.0
MuseScore {
menuPath: "Plugins.transposeDown"
onRun: {
for (var i = 1; i-- > 0;) {
cmd("transpose-down");
}
Qt.quit();
@sscotth
sscotth / script.sh
Created September 12, 2018 16:19
Backup Restore File Permissions
getfacl -R folder > /tmp/permissions.acl
setfacl --restore=/tmp/permissions.acl
@sscotth
sscotth / ebay_search_filter.user.js
Last active October 30, 2017 05:08
Ebay search filter
// ==UserScript==
// @name Hide Ebay auctions unless "Buy it now" or near end for Greasemonkey/Tampermonkey
// @namespace sscotth.io
// @description Hides Ebay auctions unless "Buy it now" or near end
// @include https://www.ebay.com/*
// @version 1
// @grant none
// ==/UserScript==
(() => {
@sscotth
sscotth / google_redirect_for_ddg.user.js
Last active October 6, 2017 22:37
DuckDuckGo UserScript
// ==UserScript==
// @name Google redirect for DuckDuckGo for Greasemonkey/Tampermonkey
// @namespace sscotth.io
// @description Adds a Google redirect link to your DuckDuckGo search results
// @include https://duckduckgo.com/?q=*
// @version 1
// @grant none
// ==/UserScript==
(() => {
@sscotth
sscotth / snippet.js
Created June 15, 2017 23:26
Load Script From Url
(() => {
const src = 'https://cdn.jsdelivr.net/react/latest/react.min.js'
const script = document.createElement('script')
script.src = src
document.body.appendChild(script)
})()
/* alphanum.js (C) Brian Huisman
* Based on the Alphanum Algorithm by David Koelle
* The Alphanum Algorithm is discussed at http://www.DaveKoelle.com
*
* Distributed under same license as original
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
@sscotth
sscotth / table2pojo.js
Last active May 1, 2017 23:37
Converts an HTML table to a plain JavaScript Object (POJO)
[...document.querySelectorAll('tr')].slice(1).map(row=>([...document.querySelectorAll('th')].map(el=>el.textContent).reduce((obj,head,i)=>({...obj,[head]:row.querySelectorAll('td')[i].textContent}),{})))
const clone = thing => Array.isArray(thing) ? [...thing] : Object(thing) === thing ? {...thing} : thing
@sscotth
sscotth / formdata.js
Last active March 28, 2017 08:25
Form serialization to object
[...new FormData(document.querySelector('form'))].reduce((o, [name, value]) => ({ ...o, [name]: value }), {})