This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "RestRequest.h" | |
@implementation RestRequest | |
@synthesize baseURL; | |
@synthesize http_username; | |
@synthesize http_password; | |
- (void) dealloc { | |
[baseURL release]; | |
[http_username release]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "RestRequest.h"@implementation RestRequest | |
@synthesize baseURL; | |
@synthesize http_username; | |
@synthesize http_password; | |
- (void) dealloc { | |
[baseURL release]; | |
[http_username release]; | |
[http_password release]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import "HTTPRiot.h" | |
@protocol RestRequestDelegate; | |
@interface RestRequest : HRRestModel <HRResponseDelegate> { | |
NSString *baseURL; | |
NSString *http_username; | |
NSString *http_password; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
//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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Test::Unit::TestCase.send :include, Sinatra::Test | |
class Waste < Sinatra::Base | |
get '/' do | |
puts session[:test] | |
end | |
end | |
describe 'Waste' do | |
before { @app = Waste } |