Skip to content

Instantly share code, notes, and snippets.


Adam Bohannon abohannon

Block or report user

Report or block abohannon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
abohannon / tictactoeconstanttime.js
Created Dec 23, 2018
TicTacToe game of any size that determines a winner in O(1)
View tictactoeconstanttime.js
class TicTacToe {
constructor(size) {
this.size = size = Math.floor(this.size / 2)
this.state = {
board: [],
score: [],
move: 0,
View setOfStacks.js
class StackSet {
constructor(maxSize) {
if (arguments.length < 1) {
throw new Error ('Woops, maxSize is required!')
this.stacks = [[]]
this.maxSize = maxSize
View Redux Reducer Boilerplate
const INITIAL_STATE = {};
export default (state = INITIAL_STATE, action) => {
switch (action.type) {
const newState = {};
return {...state, ...newState};
return state;
abohannon /
Created Dec 29, 2017 — forked from PurpleBooth/
A template to make good

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.


abohannon / PrivateRoute.js
Created Dec 22, 2017
React/Redux Auth with Private Route Component
View PrivateRoute.js
import React from 'react';
import { Route, Redirect } from 'react-router-dom';
const PrivateRoute = ({ component: Component, authed, }) => (
render={props => (
? <Component {...props} />
: <Redirect to="/login" />
View Express Server Snippet
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const routes = require('./routes');
abohannon / index.js
Last active Aug 20, 2017
Gist for leaderboard react app
View index.js
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import registerServiceWorker from './registerServiceWorker';
import axios from 'axios';
class Board extends React.Component {
constructor(props) {
abohannon / eloquent-javascript-exercises.js
Last active Jul 20, 2017
Eloquent Javascript Exercise Solutions
View eloquent-javascript-exercises.js
// My answers to the exercises in Eloquent Javascript
// Looping a triangle
var myStr = '';
for (var i = 1; i < 7; i++){
console.log(myStr += "#");
View trump-quote2
"quote": "I will be the greatest jobs president that God ever created.",
"author": "Donald Trump",
"index": 1},
"quote": "When Mexico sends its people, they're not sending their best. They're sending people that have lots of problems...they're bringing drugs, they're bringing crime. They're rapists.",
"author": "Donald Trump",
"index": 2
}, {
You can’t perform that action at this time.