Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
💻

Scott Humphries sscotth

🏠
💻
View GitHub Profile
View hangup.xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Hangup />
</Response>
@sscotth
sscotth / 1.js
Created Mar 3, 2020
Strip Undefined properties
View 1.js
// const obj = { a: undefined, b: 2, c: 0, d: null, e: 0.3, f: "", g: false }
Object.fromEntries(Object.entries(obj).filter(([k, v]) => v != null))
// => {b: 2, c: 0, e: 0.3, f: "", g: false}
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
#
# Setup
# 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
You can’t perform that action at this time.