Skip to content

Instantly share code, notes, and snippets.

@erikeldridge
erikeldridge / SqliteStore.php
Created Apr 21, 2010
a simple key/val store using php & sqlite
View SqliteStore.php
<?php
// a simple key/val store using php & sqlite
// license: http://gist.github.com/375593
class SqliteStore {
function __construct($tableName, $filePath = 'db.sqlite') {
$this->tableName = sqlite_escape_string($tableName);
if (is_numeric($tableName[0])) {
$details = sprintf(
"sqlite will choke on table names that start w/ a number. yours starts w/ '%s'",
@erikeldridge
erikeldridge / yui3-string-utils.js
Created May 9, 2010
a YUI 3 module for string utilities
View yui3-string-utils.js
// a YUI 3 module for string utilities
// ref: http://developer.yahoo.com/yui/3/yui/#yuiadd
YUI.add( 'string', function(Y) {
// parseUri 1.2.2
// (c) Steven Levithan <stevenlevithan.com>
// MIT License
// Source: http://stevenlevithan.com/demo/parseuri/js/assets/parseuri.js
// Retrieved: 5/10/10
@erikeldridge
erikeldridge / README.md
Last active Feb 12, 2018
Utils for working with GCloud service accounts
View README.md
@erikeldridge
erikeldridge / example.rb
Created Apr 29, 2010
A utility for signing an url using OAuth in a way that's convenient for debugging
View example.rb
require 'oauth_util.rb'
require 'net/http'
o = OauthUtil.new
o.consumer_key = 'examplek9SGJUTUpocjZ5QjBJmQ9WVdrOVVFNHdSR2x1TkhFbWNHbzlNQS0tJnM9Y29uc3VtkZXJzZWNyZXQmeD0yYg--';
o.consumer_secret = 'exampled88d4109c63e778dsadcdd5c1875814977';
url = 'http://query.yahooapis.com/v1/yql?q=select%20*%20from%20social.updates.search%20where%20query%3D%22search%20terms%22&diagnostics=true';
@erikeldridge
erikeldridge / ivy_html_to_csv.js
Last active Dec 29, 2016
janky ivy tree parser
View ivy_html_to_csv.js
/*
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 / demo.html
Created Oct 11, 2010
A simple YUI 3 module for adding Yahoo! login to a page
View demo.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<!-- Licensed under Yahoo! BSD license http://gist.github.com/375593 -->
</head>
<body>
<span id="login"></span>
View DBHelper.java
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 Dec 10, 2015
android utility functions
View Util.java
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 Jul 25, 2012
yet another OAuth util
View oauth_util.rb
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 Jul 21, 2012
yet another rack router
View config.ru
require 'router'
use Rack::Static, :urls => ['/css', '/js'], :root => "static"
run Router.new