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
require 'benchmark'
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '4.2.3'
@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()

#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

#!/usr/bin/ruby
require 'benchmark'
puts "Running Ruby #{RUBY_VERSION}"
ary = []
1000.times {
ary << {
#!/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'
@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
@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 / 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;
http://guides.rubyonrails.org/v3.2.13/
https://devcenter.heroku.com/articles/getting-started-with-rails3
https://devcenter.heroku.com/articles/heroku-postgresql