Skip to content

Instantly share code, notes, and snippets.

View arktisklada's full-sized avatar

Clayton Liggitt arktisklada

  • New York -> San Francisco
View GitHub Profile
@arktisklada
arktisklada / gist:6242086
Last active December 21, 2015 03:28
Backbone.js Notes

Backbone.js Scaffolding

This is an exercise in building a basic Backbone.js blog site. Backbone is a JavaScript MVC, and creates a lightweight single page app with multiple views. Later in the week, we will add a backend database connection and AJAX data between. For now, we can start with a simple single-page app with no backend and all the backbone code in one JS file.

Objectives:

  • Build a backbone app from scratch using the following components
    • Model
      • Collection
      • View
      • Router
@arktisklada
arktisklada / index.html
Last active December 21, 2015 03:28
Backbone.js Blog Sample
<!DOCTYPE html>
<html>
<head>
<title>Backbone.JS-powered Blog</title>
<link href="styles.css" rel="stylesheet" />
</head>
<body>
<!-- This will be our main container -->
http://guides.rubyonrails.org/v3.2.13/
https://devcenter.heroku.com/articles/getting-started-with-rails3
https://devcenter.heroku.com/articles/heroku-postgresql
@arktisklada
arktisklada / mysql.sql
Last active July 25, 2019 21:14
Various mysql database commands
/* database size */
SELECT table_schema "table_name",
sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB",
sum( data_free )/ 1024 / 1024 "Free Space in MB"
FROM information_schema.TABLES
GROUP BY table_schema;
@arktisklada
arktisklada / .git_profile
Last active August 29, 2015 14:06
git_prompt method to include git branch and significant symbols in bash prompt
git_prompt () {
if ! git rev-parse --git-dir > /dev/null 2>&1; then
return 0
fi
git_branch=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')
status=''
# Ensure the index is up to date.
git update-index --really-refresh -q &>/dev/null;
@arktisklada
arktisklada / .git-completion.bash
Created September 17, 2014 18:31
Script to enable tab-complete with git
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
# *) local and remote tag names
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
#!/usr/bin/ruby
require 'benchmark'
puts "Running Ruby #{RUBY_VERSION}"
ary = []
1000.times {
ary << {

#Scaling when tied to an external API

The growing prevalence of APIs has been both a blessing and curse. On the one hand, we can build digital products that are rich with data from all corners of the Internet. We can connect platforms that wouldn't otherwise work together, create services that analyze different data sources, and populate our databases with authentic seed data; all from information we didn't collect ourselves. On the other hand, we find ourselves building products that are at the mercy of those APIs and their stability, performance, and changes deemed necessary by their own product and development teams.

Success, even viability, for some products is critically dependent on one or more APIs. Epion Health provides an app that acts as a 3rd party interface to a major EMR (Electronic Medical Record) system. As a web-based product, nearly every page load of the app requires communication through the EMR's API. In many cases, there's no way to circumvent an API request because patient infor

@arktisklada
arktisklada / TestClass-JS.coffee
Last active December 16, 2015 16:54
Demo exercise for unit testing a basic JavaScript class in coffeescript. We have links on the page. Instead of following the link, we want to handle those requests with ajax and console.log the ajax response.
# /app/assets/javascripts/TestClass.coffee
class @TestClass
constructor: ->
@ajaxLink = $(".ajax-link")
@_initEvents()
_initEvents: ->
@ajaxLink.on "click", (e) ->
e.preventDefault()