Skip to content

Instantly share code, notes, and snippets.

@erikeldridge
erikeldridge / README.md
Last active February 12, 2018 22:56
Utils for working with GCloud service accounts
@erikeldridge
erikeldridge / ivy_html_to_csv.js
Last active December 29, 2016 05:59
janky ivy tree parser
/*
license:
This software is released under the MIT license:
Copyright (c) 2016 Erik Eldridge
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FRO
@erikeldridge
erikeldridge / DBHelper.java
Created December 30, 2012 03:40
android db classes
package com.example.test;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
public final class DBHelper extends SQLiteOpenHelper {
public static final String TAG = "DbAdapter";
public static final String DATABASE_FILE_NAME = "test.db";
@erikeldridge
erikeldridge / Util.java
Last active December 10, 2015 07:58
android utility functions
package com.example.test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.json.JSONArray;
import android.util.Log;
@erikeldridge
erikeldridge / oauth_util.rb
Created July 25, 2012 04:42
yet another OAuth util
require 'rubygems'
require 'oauth'
require 'awesome_print'
require 'uri'
# Usage:
# 1) Get consumer key/secret from https://dev.twitter.com/apps
# 2) Run ruby oauth_util.rb https://api.twitter.com/statuses/home_timeline.json
# 3) Authorize as instructed
# 4) $$$
@erikeldridge
erikeldridge / config.ru
Created July 21, 2012 20:22
yet another rack router
require 'router'
use Rack::Static, :urls => ['/css', '/js'], :root => "static"
run Router.new
@erikeldridge
erikeldridge / index.html
Created July 18, 2012 05:37
pushState routing boilerplate
<!DOCTYPE html>
<html>
<body>
<a href="/edit/1" class="js-nav">edit</a><br/>
<a href="/1" class="js-nav">1</a><br/>
<a href="/" class="js-nav">default</a><br/>
<a href="#" class="create">create</a>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
var views = {};
@erikeldridge
erikeldridge / debug.sh
Created June 15, 2012 08:01
A collection of web server debug utils
# A collection of web server debug utils
# Described in http://erikeldridge.com/blog/unix
# Inspired by the work of @Pufferfish
apache_access_log=/var/log/apache2/access_log
rails_root=/usr/local/project
rails_prod_log=$rails_root/log/production.log
function tail_apache_access_log() {
tail -f $apache_access_log
@erikeldridge
erikeldridge / app_init.sh
Created April 8, 2012 20:56
Initialize heroku-ready sinatra/mustache app
echo -e "\n$0: Creating project\n"
app_name=`heroku apps:create | ruby -e 'ARGF.read =~ /([\w-]+)\.herokuapp/; puts $1'`
git clone git@heroku.com:$app_name.git
cd $app_name
echo -e "\n$0: Creating .rvmrc\n"
echo "rvm ruby-1.8.7-p330" > .rvmrc
rvm rvmrc load
/**
* @param {number} toothCount is the number of teeth in the barracuda's mouth (required)
* @param {number} weight is the weight of the barracuda
* @param {number} length is the length of the barracuda
*/
function barracuda(toothCount, weight, length){
//...
}