Skip to content

Instantly share code, notes, and snippets.

View wjessop's full-sized avatar
🤖

Will Jessop wjessop

🤖
View GitHub Profile
@implementation Connection
// …
static NSArray *requestHeaders;
+ (void)setRequestHeaders:(NSArray *)headers {
requestHeaders = headers;
}
+ (NSArray *)getRequestHeaders {
+ (Response *)get:(NSString *)url withUser:(NSString *)user andPassword:(NSString *)password {
NSMutableURLRequest *request = [NSMutableURLRequest requestWithUrl:[NSURL URLWithString:url] andMethod:@"GET"];
return [self sendRequest:request withUser:user andPassword:password];
}
// to:
+ (Response *)get:(NSString *)url withUser:(NSString *)user andPassword:(NSString *)password {
NSMutableURLRequest *request = [NSMutableURLRequest requestWithUrl:[NSURL URLWithString:url] andMethod:@"GET"];
for (NSDictionary *header in requestHeaders)
NSDictionary *api_token_header = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"X-API-Token", @"MY API KEY", nil] forKeys:[NSArray arrayWithObjects:@"name", @"value", nil]];
[Connection setRequestHeaders:[NSArray arrayWithObject:api_token_header]];
require 'rubygems'
require 'curb'
require 'benchmark'
loop do
resp = nil
t = Benchmark.measure {
resp = Curl::Easy.perform(ARGV[0])
}
puts "#{resp.response_code} : #{t}"
root 2127 0.0 0.2 2476 1112 ? Ss Oct20 0:00 /bin/sh /command/svscanboot
root 2129 0.0 0.0 1708 372 ? S Oct20 0:00 svscan /service
root 3603 0.0 0.0 1540 312 ? S 17:37 0:00 supervise foo
root 4238 0.0 0.2 2472 1064 ? S 17:47 0:00 /bin/sh ./run
root 4239 3.7 7.3 38596 33932 ? Sl 17:47 0:03 unicorn_rails master -E staging -c /home/www/foo/shared/config/unicorn.conf
will 4250 0.0 6.7 38468 31132 ? Sl 17:47 0:00 unicorn_rails worker[0] -E staging -c /home/www/foo/shared/config/unicorn.conf
namespace :deploy do
desc "Restart Application"
task :restart, :roles => :app do
sudo "kill -3 `cat #{shared_path}/pids/unicorn.pid`"
end
end
./makelib unix.a alloc.o alloc_re.o buffer.o buffer_0.o buffer_1.o \
buffer_2.o buffer_get.o buffer_put.o buffer_read.o buffer_write.o \
coe.o env.o error.o error_str.o fd_copy.o fd_move.o fifo.o lock_ex.o \
lock_exnb.o ndelay_off.o ndelay_on.o open_append.o open_read.o \
open_trunc.o open_write.o openreadclose.o pathexec_env.o \
pathexec_run.o prot.o readclose.o seek_set.o sgetopt.o sig.o \
sig_block.o sig_catch.o sig_pause.o stralloc_cat.o stralloc_catb.o \
stralloc_cats.o stralloc_eady.o stralloc_opyb.o stralloc_opys.o \
stralloc_pend.o strerr_die.o strerr_sys.o subgetopt.o wait_nohang.o \
wait_pid.o
pinky:~ will$ defaults read com.atebits.tweetie-mac filterTerms
(
"#followfriday",
bkite,
"#dailygoals",
"4sq.com",
"gowal.la",
"#superbowl",
"Super Bowl",
superbowl,
"During times of universal deceit, telling the truth becomes a revolutionary act." - George Orwell
class Status < ActiveRecord::Base
# Is there a build in way of doing this?
alias :original_to_json :to_json
def to_json(options = {})
options[:except] = :created_at
original_to_json(options)
end
end