Skip to content

Instantly share code, notes, and snippets.

View EvanBacon's full-sized avatar
🥓
Markdown developer

Evan Bacon EvanBacon

🥓
Markdown developer
View GitHub Profile
@ide
ide / gist:41a6530a0b606545c55f
Last active July 17, 2020 22:43
Moving Redux state mapper into a component
// Trying out a new syntax. It is:
//
// - not magical except for the DecoratedComponent bit
// - communicates that it returns props
// - ...that are computed from Redux data
// - resembles familiar functions like getInitialProps
// - nice aesthetically
@connect(data => X.DecoratedComponent.getDataProps(data))
export default class X extends React.Component {
@mwermuth
mwermuth / UIBezier+Arrow.swift
Created September 11, 2014 14:01
Drawing an Arrow with Swift
extension UIBezierPath {
class func getAxisAlignedArrowPoints(inout points: Array<CGPoint>, forLength: CGFloat, tailWidth: CGFloat, headWidth: CGFloat, headLength: CGFloat ) {
let tailLength = forLength - headLength
points.append(CGPointMake(0, tailWidth/2))
points.append(CGPointMake(tailLength, tailWidth/2))
points.append(CGPointMake(tailLength, headWidth/2))
points.append(CGPointMake(forLength, 0))
points.append(CGPointMake(tailLength, -headWidth/2))