This file contains hidden or 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
Want to get Evernote's attention about the fact that its app has awful performance and point out an easy fix? Paste the following test into a support ticket of the type "bug report". | |
Your iOS app hangs at the drop of a hat. Though I'm sure there are tons of things that are causing the performance of the app to not be that good, the most egregious offender here is the fact that you appear to do all of your loading and synchronization in the main thread of execution of the app. | |
When you perform long running blocking operations (like syncing notes) in the main thread, the application is unusable to the user (i.e. it hangs). Furthermore, you make poor use of modern dual-core iPhones and iPads by not multithreading. | |
Please, for the love of all that is sacred, do your data synchronization on a secondary thread so that when I open the app, I can immediately get to doing what I want to do. | |
There may be some parts of this process that might have to be blocking (like updating the UITableView of notes, for instanc |
This file contains hidden or 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
ActiveRecord::Base.transaction do | |
PlaylistSong.delete(playlist_id:params[:playlist_id]) | |
#<create the new PlaylistSong objects | |
end |
This file contains hidden or 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 do_error_prone_thing | |
begin | |
toss_peanut_and_try_catching_it_in_your_mouth | |
rescue PeanutNotCaught => e | |
casually_pretend_it_did_not_happen | |
end | |
end |
This file contains hidden or 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 do_error_prone_thing | |
toss_peanut_and_try_catching_it_in_your_mouth | |
rescue PeanutNotCaught => e | |
casually_pretend_it_did_not_happen | |
end |
This file contains hidden or 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
<a href="mailto:[email protected][email protected]&subject=$1">Give Aaron some MONAY</a> |
This file contains hidden or 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
git commit —allow-empty -m 'Look ma, no diffs!' |
This file contains hidden or 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
select * from forum_topics where forum_id=42 order by (sticky_topic=true) desc |
This file contains hidden or 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 has_cookie? | |
true | |
end |
This file contains hidden or 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
thing.should have_cookie |
This file contains hidden or 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
require "minitest/autorun" | |
#To run the test, make sure you have the minitest gem installed and just type ruby test_missing_integer.rb at the prompt | |
#after downloading this file. | |
#To submit the exercise, put the code into a gist and share with us. | |
#this method takes an array with 99 elements. The elements are the integers 1 through 100, but one is missing. | |
#The elements aren't sorted in any particular order. | |
#This method returns the number that's missing. |
OlderNewer