Skip to content

Instantly share code, notes, and snippets.

View johnlaine1's full-sized avatar

John Laine johnlaine1

View GitHub Profile
@johnlaine1
johnlaine1 / .gitconfig
Last active August 14, 2016 13:52
Sample .gitconfig file
[alias]
llog = log --oneline --abbrev-commit --all --graph --decorate --color
st = status
br = branch
co = checkout
@johnlaine1
johnlaine1 / rectangleIntersection.js
Last active March 7, 2017 02:18
A function that finds the rectangle intersection of 2 rectangles
const findRangeOverlap = (point1, length1, point2, length2) => {
const highestStartPoint = Math.max(point1, point2);
const lowestEndPoint = Math.min(point1 + length1, point2 + length2);
if (highestStartPoint >= lowestEndPoint) {
return {startPoint: null, width: null};
}
const overlapLength = lowestEndPoint - highestStartPoint;
return {startPoint: highestStartPoint, overlapLength: overlapLength};
@johnlaine1
johnlaine1 / app.js
Created October 10, 2017 21:35 — forked from verticalgrain/app.js
React Router V4 Redirect after form submission
import React, { Component } from 'react'
import { Redirect } from 'react-router'
export default class ContactForm extends Component {
constructor () {
super();
this.state = {
fireRedirect: false
}
}