Skip to content

Instantly share code, notes, and snippets.

View kyleshevlin's full-sized avatar

Kyle Shevlin kyleshevlin

View GitHub Profile
@kyleshevlin
kyleshevlin / MenuCardEditing.jsx
Created June 11, 2017 18:41
react-select being a PITA
import { h, Component } from 'preact'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import Select from 'react-select'
class MenuCardEditing extends Component {
constructor (props) {
super(props)
this.state = {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@kyleshevlin
kyleshevlin / index.js
Last active August 8, 2017 21:04
Longest Palindrome
const isPalindrome = str => str === str.split('').reverse().join('')
function longestPalindrome(str) {
const result = []
const characterMap = str.split('').reduce((acc, char) => {
if (!acc[char]) {
acc[char] = 0
}
@kyleshevlin
kyleshevlin / README.md
Created October 22, 2017 23:59
Kyle's Known (Mostly) Abandoned Ideas

Kyle's Known Abandoned Ideas

  • Agathist Collective - Development Agency/Freelancing Idea - partially resurrected as Agath.ist, but I've never done 1 ounce of work as it.
  • FeedMe v1 - An app that let's you store your meals and make menus easily. I'm starting v2 now, because this would be really helpful for me and my wife. I'm really simplifying it. But it was abandaned for most of a year.
  • Tempo - a minimalist ticket/issue tracking app. Cause Jira sucks and I can't make something that's easier to use.
  • Attune - A web-browser pitch tuning app, so I can tune my guitar using the web audio API.
  • Destiny Netzero - a chrome extension that would act as a counter timer to all the time I wasted playing Destiny (a video game). Essentially would run as I was productive and I would try and get back the 1800+ hours of my life I put in the game.
  • My D&D App - I was building an application to make it easier to track my D&D character, but I stopped playing so I abandoned the project.
  • Down The Dr
@kyleshevlin
kyleshevlin / index.html
Last active January 31, 2018 06:56
Hyperapp Clock
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HyperApp Awesomeness</title>
</head>
<body>
<script src="https://unpkg.com/hyperapp"></script>
<script>
(function() {
@kyleshevlin
kyleshevlin / index.js
Created November 17, 2018 17:16
debounce and throttle
// Debounce waits until an elapsed amount of time has passed since the previous call to fire the function
// Essentially, we cancel all calls until a timeout has passed.
// This is accomplished by creating a new function to fire our original function with the correct arguments
// but calling it inside a timeout which we are able to clear whenever the function is called.
const debounce = (fn, wait) => {
// We need to hold our various timeouts in closure
let timeout
// We return an anonymous function, gathering any arguments passed to it in the args array
return (...args) => {
@kyleshevlin
kyleshevlin / partialApplication.js
Created April 27, 2019 17:38
Partial Application via Bind
// Can't use curried functions for some reason?
// Never fear, partial application via the bind() method is here!
const getFromAPI = (baseURL, endpoint, callback) =>
fetch(`${baseURL}${endpoint}`)
.then(res => res.json())
.then(data => callback(data))
// Partially apply the baseURL
const getFromGithub = getFromAPI.bind(null, 'https://api.github.com')
@kyleshevlin
kyleshevlin / index.js
Created August 3, 2019 16:24
Match vs Test - Know what you need
const blockchainPattern = /blockchain/gi
// Please note my sarcasm and humor in these, I don't mean any of them.
const sentences = [
"JavaScript isn't a _real_ language.",
"What if we put it on the blockchain?",
"The government's hacking our IoT devices, man!",
"Pretty sure we can fix JavaScript with Blockchain."
]