Skip to content

Instantly share code, notes, and snippets.

View beausmith's full-sized avatar
🍞
Probably baking something.

Beau Smith beausmith

🍞
Probably baking something.
View GitHub Profile
@beausmith
beausmith / inputHandler.jsx
Created May 2, 2018 23:17
One React method to control all html form elements
updateInputValue = ({ currentTarget: { name, value, checked, type } }) => {
this.setState({
[name]: type === 'checkbox' ? checked : value || this.initialState[name]
})
}
@beausmith
beausmith / SVG.js
Created May 23, 2017 18:09
React Native SVG Component using react-native-svg
// React Native SVG Component
// https://github.com/react-native-community/react-native-svg
//
// Process
// 1. Clean up SVG in graphics app (Illustrator/Sketch/etc) to set consistent width, height, and make sure the viewBox is "0, 0, W, H"
// 2. Open SVG in text editor to remove width, height, and any undesired/unnecessary styles
// 3. Open in https://jakearchibald.github.io/svgomg/ and optimize.
// 4. Integrate info app by converting SVG tags to component-based SVG tags used in https://github.com/react-native-community/react-native-svg and updating with JS variables such that I can controls dimensions, colors, etc.
// 5. Use in other components.
//
@beausmith
beausmith / SVG.js
Created May 23, 2017 18:09
React Native SVG Component
// React Native SVG Component
// https://github.com/react-native-community/react-native-svg
//
// Process
// 1. Clean up SVG in graphics app (Illustrator/Sketch/etc) to set consistent width, height, and make sure the viewBox is "0, 0, W, H"
// 2. Open SVG in text editor to remove width, height, and any undesired/unnecessary styles
// 3. Open in https://jakearchibald.github.io/svgomg/ and optimize.
// 4. Integrate info app by converting SVG tags to component-based SVG tags used in https://github.com/react-native-community/react-native-svg and updating with JS variables such that I can controls dimensions, colors, etc.
// 5. Use in other components.
//
@beausmith
beausmith / Examples.md
Last active June 6, 2017 23:59
Examples

Dissatisfied with work from InfiniteRed

We hired InfiniteRed, instead of a less expensive contract-developer option, because we were promised a senior-level engineer and React Native expert.

Rather than learning and making progress with solid code from the InfiniteRed expert, we found ourselves continually surprised by the lack of code quality. Once we realized the code from our assigned expert was not of expert or senior level, we decided to wind down the contract.

Since parting with InfiniteRed, we regularly find bugs and surprising bits of code to clean up originating from our assigned expert.

Below are some of bugs and poor quality code which was committed to our repo by our assigned InfiniteRed expert. There are more examples, but this should be sufficient to prove that we were not assigned an expert or senior-level engineer.

@beausmith
beausmith / ship
Created December 29, 2016 22:49
ship - alias for pushing git branches to a remote
#!/bin/bash
set -e
CURRENT=$(git symbolic-ref -q HEAD || git rev-parse HEAD)
CURRENT=${CURRENT#refs/heads/}
gitdir=$(git rev-parse --git-dir)
# default settings
verbose=true
@beausmith
beausmith / gpr
Last active December 29, 2016 22:43
Pull Request from
#!/usr/bin/env bash
set -e
urlencode() {
read
local length="${#REPLY}"
for (( i = 0; i < length; i++ )); do
local c="${REPLY:i:1}"
case $c in
### Keybase proof
I hereby claim:
* I am beausmith on github.
* I am beausmith (https://keybase.io/beausmith) on keybase.
* I have a public key whose fingerprint is 70C7 A12F 31C3 A983 EE98 7C5D 9355 8244 0AD3 A25F
To claim this, I am signing this object:
@beausmith
beausmith / Slim for loop
Created October 23, 2013 22:40
Iterating through an array using a for loop in slim lang template
- for i in (1..5)
div #{i}
- for i in [0,4,8,12,16,20,24] do
div #{i} #{i + -12}
- if (i == 0)
div 0
- elsif (i < 12)
div lt 12
- else

Some updates to Angelina Fabbro's tremendous original reference document. The most notable additions are shadow pseudoclasses for scroller pseudoelements.

A friendly reminder that you may need to set this property on your target/selected element to get the styling results you want: -webkit-appearance:none;

<video>

video::-webkit-media-controls-panel

@beausmith
beausmith / isotope-centered-masonry-and-masonry-gutters.js
Last active November 6, 2019 04:24 — forked from mattstauffer/gist:3835881
Isotope with Centered Masonry and Masonry Gutters.
$(function() {
// Tweaked from: https://gist.github.com/mattstauffer/3835881
// No guarantees
// 1. include Isotope.js
// 2. include this file
// 3. customize Isotope options at the bottom of this file
// 4. add "margin: 0 auto" to the isotope container
$.Isotope.prototype._getMasonryGutterColumns = function() {