Skip to content

Instantly share code, notes, and snippets.

View jonathanbarton's full-sized avatar

Jonathan Barton jonathanbarton

View GitHub Profile
@jonathanbarton
jonathanbarton / accessor_example
Created August 18, 2015 00:39
accessor example
//
// BillManager.swift
// SushiOrder
//
// Created by Jonathan Barton on 8/17/15.
// Copyright (c) 2015 Jonathan Barton. All rights reserved.
//
import UIKit
@jonathanbarton
jonathanbarton / week4_assignment.md
Last active August 29, 2015 14:28
Week 4 Assignment

#Week 4 Assignment

Description

We will be creating an app with a table view that displays 3 animals in its list (default: tiger, bear, eagle), and the user can also add a new animal to the list.

Definition of Done

  • All Acceptance Criteria met
  • Project runs and all items are functioning
  • Project solution pushed out to proper branch and pull request opened

Project Setup

@jonathanbarton
jonathanbarton / alternating_arrays_problem
Created March 14, 2016 19:28
simple_programming_problem_lists_strings_10: Alternating Arrays
var arr1 = ['a','b','c'];
var arr2 = ['r','t','z','f'];
var alternateArray = function(a, b) {
var i = 0, result = [];
while(a[i] || b[i]) {
if(a[i]){
result.push(a[i]);
}
if(b[i]){
@jonathanbarton
jonathanbarton / selection_sort_problem
Created March 14, 2016 23:45
selection_sort_problem
function selectionSort(arr, currentMin) {
while(currentMin === undefined || currentMin < arr.length) {
currentMin = currentMin || 0;
for(var i = currentMin; i < arr.length; i++){
if(arr[currentMin] > arr[i]){
var a=arr[currentMin],b=arr[i];
b = [a, a = b][0];
arr[currentMin] = a;
arr[i] = b;
}
@jonathanbarton
jonathanbarton / weird_request_buffer
Created March 29, 2016 21:58
weird_request_buffer
function authenticate(req, res) {
let options = {
method: 'POST',
url: 'http://connected-qa.cdiapps.com/api/v0.1/session',
headers: {
'content-type': 'application/json',
'accept': 'application/json',
'accept-encoding': 'gzip, deflate',
'accept-language': 'en-US,en;q=0.8,ja;q=0.6'
@jonathanbarton
jonathanbarton / sort_algorithms_javascript
Created May 2, 2016 01:50
sort_algorithms_javascript
//Insertion Sort
https://jsfiddle.net/0sxhch8d/
@jonathanbarton
jonathanbarton / gomake-telemetry.service.md
Last active July 23, 2016 23:41
gomake-telemetry.service systemd script

Create service config file:

sudo nano /lib/systemd/system/gomake-telemetry.service

/lib/systemd/system/gomake-telemetry.service contents:

[Unit]
Description=goMake Telemetry Service
After=multi-user.target
@jonathanbarton
jonathanbarton / steps_for_rollback
Created August 18, 2016 20:04
STEPS FOR ROLLBACK
1. ) Take backup/snapshot of current data AND schema for current PROD database:
dledimsum-prod-aurora
2. ) Export data for dimsum.productEnrollments view -> .sql file
3.) Perform code rollback steps
4.) Create new database with name dledimsum-prod-120-aurora
5. Restore last Datapipe snapshot from dledimsum-prod-aurora into dledimsum-prod-120-aurora (referenced during call as UTC 8-17 PM time)
@jonathanbarton
jonathanbarton / giphy.py
Last active January 5, 2017 01:00
giphy.py
import giphypop
import urllib
import os
FILE_TYPE = '.gif'
BASE_PATH = os.environ.get('BASE_PATH') or '/usr/local/mhe-dashboard'
GIF_COUNT = os.environ.get('GIF_COUNT') or 20
DAYS_TO_KEEP = 5
def get_filename(media_url):
@jonathanbarton
jonathanbarton / gmk-env.txt
Created February 18, 2017 02:22
gmk-env.txt
GM_JWT_SECRET=I3kyc22gcIbbomRKcAvZkFZpFORxqYTEd7pWVUP8qAlUwSQYCEwepki7yCT0FCfQ
GM_JWT_AUDIENCE=KxwSnu3NgCtJKbtSXYc4gFtTOhgDn1rw
GM_DB='mongodb://localhost/express-mongoose-es6-rest-api-development'
GM_PORT=3000
GM_AUTH0_DOMAIN='gomake.auth0.com'
GM_AUTH0_CALLBACK_URL="http://localhost:3000/auth0/login"
GM_SENDBIRD_API_TOKEN=bf73fd45f29cc0c95766a8b41956d048d8d709cf