Skip to content

Instantly share code, notes, and snippets.


Aaron Roberson aaronroberson

View GitHub Profile
aaronroberson / flatten-nested-array.js
Last active September 23, 2017 00:43
flattens a nested array of integers at any depth
View flatten-nested-array.js
* flattenNested - Reduces an array of arbitrarily nested arrays of integers into a flat array of integers.
* @param value {Array} - The array to flatten.
* @param iterator {Array} - An array used for initializing or for iteration during recursion.
* @returns {Array} - The flattened array, yay!
function flattenNested(value, iterator = []) {
// Add exit case straight away to help prevent stack overflow
if (!value) return iterator;
aaronroberson / cart-controller.js
Last active May 27, 2016 01:15
Geekwise Day 8 Assets
View cart-controller.js
(function(angular) {
var app = angular.module('MyStore');
// Inject in the CartService
app.controller('CartController', function($scope) {
// Set the items on the scope to the items in the CartService
View meteor-nginx-static-cache
http {
proxy_cache_path /tmp/nginx/cache
max_size=1g inactive=1d;
proxy_temp_path /tmp/nginx/tmp;
server {
listen 80;
aaronroberson / add-cart-button.html
Last active November 13, 2015 13:41
Geekwise2 Day 7 - Shopping Cart
View add-cart-button.html
<button class="btn btn-primary"><i class="glyphicon glyphicon-plus"></i> Add to cart</button>
View post-merge
#/usr/bin/env bash
# MIT © Sindre Sorhus -
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
aaronroberson / emptyCart
Last active August 29, 2015 14:04
Geekwise2 Day 8 - Shopping Cart Part 2
View emptyCart
emptyCart: function() {
// Sets items object to an empty object
items = {};
// Remove the items cookie
aaronroberson / 0_reuse_code.js
Created July 9, 2014 03:34
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
aaronroberson / Swag.js
Last active August 29, 2015 14:03
Geekwise2 Day 5
View Swag.js
// Require mongoose dependency
var mongoose = require('mongoose');
// Create a swag schema
var swagSchema = mongoose.Schema({
id: Number,
isFeatured: Boolean,
isActive: Boolean,
price: Number,
specialPrice: Number,
aaronroberson / swag.html
Last active August 29, 2015 14:03
Geekwise2 Day 3
View swag.html
<div class="col-md-3" ng-repeat="item in swag">
<h4 ng-bind="item.title"></h4>
<div class="row">
<div class="col-xs-4 col-md-6">
<a href="#" class="thumbnail">
<img ng-src="item.images[0]" alt="item.title">
<p ng-bind="item.description"></p>
aaronroberson / data-binding
Last active August 29, 2015 14:03
Geekwise2 Day 2
View data-binding
<!doctype html>
<html ng-app>
<head lang="en">
<meta charset="UTF-8">