Skip to content

Instantly share code, notes, and snippets.

View tannerburson's full-sized avatar

Tanner Burson tannerburson

View GitHub Profile
#import "RestRequest.h"
@implementation RestRequest
@synthesize baseURL;
@synthesize http_username;
@synthesize http_password;
- (void) dealloc {
[baseURL release];
[http_username release];
#import "RestRequest.h"@implementation RestRequest
@synthesize baseURL;
@synthesize http_username;
@synthesize http_password;
- (void) dealloc {
[baseURL release];
[http_username release];
[http_password release];
#import <Foundation/Foundation.h>
#import "HTTPRiot.h"
@protocol RestRequestDelegate;
@interface RestRequest : HRRestModel <HRResponseDelegate> {
NSString *baseURL;
NSString *http_username;
NSString *http_password;
}
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
<input type="text" id="business_name"/>
<input type="text" id="what_do"/>
<input type="button" id="button">
<script>
$(document).ready(function(){
#!/usr/bin/ruby -rubygems
$:.unshift(File.dirname(__FILE__))
require 'deploy-script'
Deploy::app :name do
@app_path = '/path/to/blog' # cd to this directory before anything else
@repo_url = 'git://github.com/tannerburson/blog.tannerburson.com.git'
end
deploying :name do
<?
//This is terribly insecure. We don't even pretend that we're authenticating here.
//We take parameters straight from _GET.
//Don't actually use this as is, please.
//Simple UPC -> ISBN code
function parseUPC($upc) {
if(false !== strstr($upc,'978')){
$isbn = substr($upc,3,9);
$xsum=0;
import android
import httplib
import urllib
while(True):
droid = android.Android()
code = droid.scanBarcode()
isbn = code['result']['SCAN_RESULT']
sleep(5)
if not isbn: # Scan failed for some reason, bail.
#This should insert all the rack test methods into your current test context.
#Modify as appropriate for your specific test framework.
#If you're including the Sinatra::Test in each of your tests, you'll need to
#include Rack::Test::Methods instead.
Test::Unit::TestCase.send :include, Sinatra::Test
#becomes
Test::Unit::TestCase.send :include, Rack::Test::Methods
#!/usr/bin/env ruby
require 'rubygems'
gem 'rack', '=0.9.1'
gem 'thin', '=1.0.0'
require 'sinatra/base'
## To run this just run thin -R config.ru start
## The default tests pass, allowing the app to start. If the tests failed, the app would not even attempt to start.
##
## Wrap up our sample app in a class, this let's us keep the entire app
Test::Unit::TestCase.send :include, Sinatra::Test
class Waste < Sinatra::Base
get '/' do
puts session[:test]
end
end
describe 'Waste' do
before { @app = Waste }