Skip to content

Instantly share code, notes, and snippets.

Avatar

Austin Wood indiesquidge

  • San Francisco, CA
View GitHub Profile
View with-class.jsx
export class UserList extends React.Component {
state = { count: 0 };
handleClick = (item) => {
setTimeout(() => {
console.log(`You clicked ${this.props.group} ${this.state.count} times`);
}, 3000);
};
render() {
@indiesquidge
indiesquidge / homebrew.md
Last active Nov 15, 2020
How to and Best of Homebrew
View homebrew.md

Homebrew

How To

Homebrew is a package management system for OS X. You can read more about it here, or simply run

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

to install it.

View add-eventing.js
const addEventing = function (obj) {
let events = {}
obj.on = (eventName, fn) => {
if (events[eventName]) {
events[eventName].push(fn)
} else {
events[eventName] = [fn]
}
}
@indiesquidge
indiesquidge / subdomain-localhost-rails-5.md
Created Jan 19, 2016
how to access subdomains locally with Rails 5
View subdomain-localhost-rails-5.md

Subdomaining Localhost with Rails 5

I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api

Rails.application.routes.draw do
  constraints subdomain: "api" do
    scope module: "api" do
View Reach Philosophy.md

Reach UI Philosophy

Reach UI is an accessible foundation for React applications and design systems.

The three equally important goals are to be:

  • Accessible
  • Composable
  • Stylable
@indiesquidge
indiesquidge / App.js
Created Oct 6, 2017
Mocking globals in Jest
View App.js
import React, { Component } from 'react';
class App extends Component {
constructor () {
super()
this.state = {
name: null,
imgUrl: null
}
}
View pull_request_template.md
Status Type Env Vars Change Review App Ticket
Ready/Hold Feature/Bug/Tooling/Refactor/Hotfix Yes/No Link Link

⚠️ NOTE: use notes like this to emphasize something about the PR. This could include other PRs this PR is built on top of; new or removed environment variables; reasons for why the PR is on hold; or anything else you would like to draw attention to.

Problem

What problem are you trying to solve?

View advanced-react-notes.md

Advanced React by React Training

Personal notes while working through Advanced React: https://courses.reacttraining.com/p/advanced-react

Granted this is a contrived example, but it's still something I took notice to: in those "Advanced React" videos I've been watching, Ryan Florence codes very slowly, and does not make one quick change and jump back to the browser to see what changed.

He stops and thinks. He asks himself (or the viewer) questions. He wonders what

@indiesquidge
indiesquidge / objects-over-classes.md
Last active Aug 4, 2020
We are better off avoiding ES6 classes in JavaScript when possible
View objects-over-classes.md

Plain JavaScript objects are better than classes when they can be used, and many popular modern frameworks have adopted their use.

Consider that in React a component can be created as either a class or as an object.

// using a class
class Welcome extends React.Component {
  render() {
    <h1>Hello, {this.props.name}</h1>
@indiesquidge
indiesquidge / express-example.md
Last active Jul 14, 2020
Custom port on Express.js
View express-example.md

Express.js Example

Setup

This code is a direct copy of the code found on the Express.js site under Getting Started. I just followed installing and hello world from there to get a basic server up and running.

(index.js file)

You can’t perform that action at this time.