Skip to content

Instantly share code, notes, and snippets.

🏠
💻

Scott Humphries sscotth

🏠
💻
Block or report user

Report or block sscotth

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View objectmap.js
const obj = { foo: 'hello', bar: 'world' }
const updatedObj = Object.fromEntries(
Object.entries(obj).map(([key, val]) => [
key,
val.toUpperCase(),
]),
)
// {foo: "HELLO", bar: "WORLD"}
View transposedown.qml
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 / test.js
Created Mar 21, 2019
mdx Elements
View test.js
const assert = require('assert')
const mdx = require('@mdx-js/mdx')
const text = 'foo'
const expected = el =>
`\n\nconst layoutProps = {\n \n};\nexport default class MDXContent extends React.Component {\n constructor(props) {\n super(props)\n this.layout = null\n }\n render() {\n const { components, ...props } = this.props\n\n return <MDXTag\n name="wrapper"\n \n components={components}><${el}>${text}</${el}>\n </MDXTag>\n }\n}\nMDXContent.isMDXComponent = true`
const elements = [
// Unknown HTML Elements
@sscotth
sscotth / script.sh
Created Sep 12, 2018
Backup Restore File Permissions
View script.sh
getfacl -R folder > /tmp/permissions.acl
setfacl --restore=/tmp/permissions.acl
@sscotth
sscotth / amazon-gift-card-userscript.js
Created Mar 5, 2018
Amazon Gift Card Auto-Redeem
View amazon-gift-card-userscript.js
// ==UserScript==
// @name Amazon Gift Card Auto-Redeem
// @version 1
// @grant none
// @match https://www.amazon.com/gc/redeem/*
// ==/UserScript==
{
setTimeout(() => document.querySelector('#gc-redemption-alert') || document.querySelector('#gc-redemption-apply-button').click(), 5000)
}
View ebay_search_filter.user.js
// ==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==
(() => {
View google_redirect_for_ddg.user.js
// ==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==
(() => {
View keystroke the clipboard basic.workflow
# Why?
# To paste text into windows that normally don't allow it or have access to the clipboard.
# Examples: Virtual machines that do not yet have tools installed, websites that highjack paste
#
# How?
# Create a service: open Automator, create new service, receive no input, use any application, run applescript code below, save
# Activate: open application menu from menu bar, go to services, and you will see your service
on run
tell application "System Events"
@sscotth
sscotth / snippet.js
Created Jun 15, 2017
Load Script From Url
View snippet.js
(() => {
const src = 'https://cdn.jsdelivr.net/react/latest/react.min.js'
const script = document.createElement('script')
script.src = src
document.body.appendChild(script)
})()
View alphanum.js
/* 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.
You can’t perform that action at this time.