Skip to content

Instantly share code, notes, and snippets.

View saylestyler's full-sized avatar
🥰
= )

Tyler Sayles saylestyler

🥰
= )
View GitHub Profile
@saylestyler
saylestyler / new_header.js
Last active February 1, 2019 17:12
adds a new element at the top of developer.mozilla.org
// add a new span element to top of mdn
var new_header = document.createElement("span")
var new_header_content = document.createTextNode("new replacement span element")
new_header.appendChild(new_header_content)
var header = document.getElementById('main-header')
@saylestyler
saylestyler / imsg.fish
Created January 4, 2019 23:23
imsg urself (forgot the source of this, twasnt i)
function imsg --description "send imessage to my myself"
osascript -e "tell application \"Messages\" to send \"$argv\" to buddy \"Tyler Sayles\""
end
* {
box-sizing: border-box;
}
html {
font-family: 'Muli', sans-serif;
background: #EAEAEA;
color: #333;
font-smoothing: antialiased;
text-rendering: optimizeLegibility;
@saylestyler
saylestyler / isPortLegal.js
Created December 16, 2018 23:19
returns true if port is legal, false if illegal; from notion.io's src
const isLegalPort = (port) => {
if ((typeof port !== 'number'
&& typeof port !== 'string')
|| (typeof port === 'string'
&& port.trim().length === 0)) {
return false
}
return +port === (+port >>> 0) && port <= 0xFFFF
}
@saylestyler
saylestyler / pollFetch.js
Created December 1, 2018 04:47
poll data @ intervals w/ setInterval() & fetch()
setInterval(() => fetch(swApi).then(r => r.json())
.then(ppl => console.log(ppl))
.catch(e => console.log('failed: ', e)
) , fiveSec)
@saylestyler
saylestyler / console_listen.js
Created November 29, 2018 02:00
SpeechRecognition snippet
var recog = new webkitSpeechRecognition
recog.onresult = event => {
var last = event.results.length - 1;
var what_you_said = event.results[last][0].transcript;
alert(what_you_said)
}
recog.start()
@saylestyler
saylestyler / hardscroll.user.js
Last active December 17, 2018 06:25
smoothest of scrolling
// ==UserScript==
// @name hard scroll
// @namespace http://tylsyl.com
// @version 0.1
// @description smoothest of scrolls
// @author Tyler Sayles
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.18.2/babel.js
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.16.0/polyfill.js
// @match *://*/*
// ==/UserScript==
class RubyUtils
def invoke_all_tools
puts 'use pry, irb, & show-source within pry'
end
end
@saylestyler
saylestyler / iching.js
Created November 10, 2018 03:17
iching
const IChing64ObjectArray = [
{ 'iChingNum': 1, 'iChingName': "1. Ch'ien / The Creative" },
{ 'iChingNum': 2, 'iChingName': "2. K'un / The Receptive }, Earth" },
{ 'iChingNum': 3, 'iChingName': '3. Chun / Difficulty at the Beginning ' },
{ 'iChingNum': 4, 'iChingName': '4. Mêng / Youthful Folly' },
{ 'iChingNum': 5, 'iChingName': '5. Hsü / Waiting (Nourishment)' },
{ 'iChingNum': 6, 'iChingName': '6. Sung / Conflict' },
{ 'iChingNum': 7, 'iChingName': '7. Shih / The Army' },
{ 'iChingNum': 8, 'iChingName': '8. Pi / Holding Together [union]' },
{ 'iChingNum': 9, 'iChingName': "9. Hsiao Ch'u / The Taming Power of the Small" },
@saylestyler
saylestyler / hardscroll.js
Created August 24, 2018 18:45
disables smooth scrolling
document.getElementsByTagName("body")[0]
.addEventListener("wheel"
, event => event.stopPropagation()
, true
)