Skip to content

Instantly share code, notes, and snippets.

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

Scott Humphries sscotth

🏠
𝄆 🍽 🛌 👨‍💻 𝄇
View GitHub Profile
@sscotth
sscotth / range.js
Last active October 25, 2020 01:43
Range
const range = n => [...Array(n).keys()]
/* 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 / 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)
})()
@sscotth
sscotth / keystroke the clipboard extended.workflow
Last active April 17, 2024 12:21
Paste as keystrokes (macOS)
# 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 hijack paste
#
# Extended vs Simple?
# * Includes an initial delay to allow you to change active windows
# * Adds small delay between keypresses for slower responding windows like SSH sessions
# * Better handling of numbers
# * VMWare bug fix
#
@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 / 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 / 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 / test.js
Created March 21, 2019 19:45
mdx Elements
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
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 / 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"}