Skip to content

Instantly share code, notes, and snippets.

@AsaAyers
AsaAyers / REMIX.md
Created Aug 16, 2021
Created from Remix Form!
View REMIX.md

now with usePendingFormSubmit()

@AsaAyers
AsaAyers / Remix test gist
Created Aug 16, 2021
Created from Remix Form!
View Remix test gist
Hello Remix!
<form>! Hello old friend! I haven't seen you in a long time.
@AsaAyers
AsaAyers / inline-tools.js
Last active Dec 5, 2018
js console tools
View inline-tools.js
/* eslint-disable func-names, no-plusplus, babel/semi, arrow-parens, no-ternary, no-undefined */
/* eslint semi: ["error", "never"] */
/* global inlineTools:true, copy */
inlineTools = (function () {
const replacer = (c) => `-${c.toLowerCase()}`
const toCSSProperty = (property) => property.replace(/[A-Z]/g, replacer)
.replace(/^webkit/, '-webkit')
@AsaAyers
AsaAyers / CleanBranches.sh
Last active Jun 2, 2021
Script for cleaning up merged branches
View CleanBranches.sh
#!/bin/bash
# This script was written with the following assumptions:
# * you have two remotes: `upstream` and `origin`.
# * you only ever push to `origin`
# For most projects this would be master, but dev is our main branch
DEFAULT_BRANCH="dev"
View match-with-transforms.js
import React from 'react'
import { Match } from 'react-router'
// example:
// <MatchWithTransforms
// transforms={{ id: Number }}
// pattern="/page/:id"
// component={ViewPage} />
const MatchWithTransforms = ({ transforms, ...matchProps}) => {
View you_dont_need_coffeescript.md

You Don't Need CoffeeScript

It's time to replace CoffeeScript with Babel and CoffeeLint with eslint.

CoffeeScript was useful a few years ago. It provided many features that JavaScript was lacking. It gave us the fat arrow (lexical this functions), default parameters, destructuring assignments, splats (spread operator), a class keyword, block strings, and more. Everything in the list above is now part of the JavaScript standard. JavaScript is moving forward and gaining

View gist:b2ade4a49b2277e0d7b2346c27229ba5
// This was written using gists editor. I hope I have the syntax right.
function HOCAutoSizer(ChildComponent) {
return function(props) { // Stateless component
return (
<AutoSizer>
{({ height, width }) => (
<ChildComponent
width={width}
height={height}
View keybase.md

Keybase proof

I hereby claim:

  • I am asaayers on github.
  • I am asaayers (https://keybase.io/asaayers) on keybase.
  • I have a public key is ASA-KrZq2n-UzkQ7If6W6JZhW2GHHBNiK8J0bXyg6INuMwo

To claim this, I am signing this object:

View destructuring.js
const someObject = {
a: "Some Value"
// ^ Input
// ^ Output: someObject.a
}
const { a: a } = someObject
// ^ Output: `const a`
// ^ Input: someObject.a
@AsaAyers
AsaAyers / coffeelint.json
Last active Aug 29, 2015
`full_coffeelint.json` is what you would get if you run `--makeconfig` and configure it to match the coffee-lint repo's rules. `coffeelint.json` is the same file run through `--trimconfig`
View coffeelint.json
{
"arrow_spacing": {
"level": "error"
},
"cyclomatic_complexity": {
"value": 11,
"level": "warn"
},
"indentation": {
"value": 4