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
Ever try to build something new and exciting? Do you find yourself wondering what libraries and tools you should depend on? Always asking questions like: Should I use this (jquery|ruby|java) plugin, or that one? | |
Finding the best tool/library/gem/plugin shouldn't be that tough, and we will review simple analytics you can apply to any project to determine if a project is the right fit. Measurements can include things such as: commit frequency, test coverage, community activity, production examples, google hits, and many others. | |
Building the tweethopper job queue processing daemon proved to be problematic when trying to scale because we made the wrong choices when it came to tools and libraries. We will discuss the choices that were made and how we came to find better tools to facilitate more and more traffic. |
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
Need to build an API and you aren't sure where to start? Wondering if you should be strict with a restful interface or version your api? Perhaps you need to secure your data with some type of encryption? | |
Explore the different options for building your application as we share our experiences from building the change: healthcare api. Learn from our choices on things like versioning the api, using AES encryption, considering HIPPA security, and much more. | |
Twitter, github, NY Times, and many others have built an API using rails, we will look at some of the choices they made in build their respective apps. The goal is to examine different approaches and leave you with the knowledge to make the choice about how to tackle your own api. |
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
begin | |
1.upto(10) do |i| | |
puts "Outer loop #{i}" | |
11.upto(20) do |j| | |
puts "Inner loop #{j}" | |
raise "Error" | |
end | |
end | |
rescue Exception => msg | |
puts msg |
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
These are just simple tests run using ab and the Handcrafted foundation (http://github.com/handcrafted/foundation). | |
Keep in mind these are basic and aren't a true apples to apples comparison yet. Using nginx combined with thin, passenger, and unicorn will allow a real comparison. If I get time I will try to run some ec2 tests. | |
Thin start | |
josh 86500 0.2 1.2 2493484 52424 s000 S+ 2:07AM 0:02.79 ruby script/server thin | |
Thin first page | |
josh 86500 0.3 1.4 2496584 58900 s000 S+ 2:07AM 0:04.07 ruby script/server thin |
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
def json_provider(provider, phone = false) | |
<<-EOF | |
"medical_provider" : { | |
"id" : #{provider.id.to_json}, | |
"name" : #{provider.name.to_json}, | |
"address" : #{provider.primary_address.address_1.to_json}, | |
"zipcode" : #{provider.primary_address.postal_code.to_json}#{"," if phone} | |
#{"\"phone\" : " + provider.telephone.to_json if phone} | |
} | |
EOF |
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
users = User.count(:id, :conditions => ["created_at >= ?", Date.today - 2.weeks], :group => "DATE(created_at)") | |
dates = {} | |
((Date.today - 2.weeks)..(Date.today)).each {|date| dates[date.to_s] = 0} | |
@sorted_users = users.reverse_merge(dates).sort_by {|count| count[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
def update | |
@saving =Saving.find(params[:id]) | |
respond_to do |wants| | |
if @saving.use! # state_machine transition method | |
wants.html { redirect_to savings_url } | |
else | |
wants.html { render :action => :edit } | |
end | |
end | |
end |
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
it "PUT #update should use a saving" do | |
saving = stub(:use! => true) | |
Saving.stubs(:find).returns(saving) | |
put :update, :id => 1 | |
response.should redirect_to(:savings_url) | |
end |
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
it "PUT #update should use a saving" do | |
saving = Factory.create(:saving) | |
put :update, :id => saving.id | |
response.should redirect_to(:savings_url) | |
end |
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
puts 'RAM USAGE: ' + `pmap #{Process.pid} | tail -1`[10,40].strip | |
answer = (1..1000000).collect - (5000..80000).collect | |
#answer.each {|id| puts id} | |
puts 'RAM USAGE: ' + `pmap #{Process.pid} | tail -1`[10,40].strip | |
answer = nil | |
GC.start | |
puts 'RAM USAGE: ' + `pmap #{Process.pid} | tail -1`[10,40].strip |