Skip to content

Instantly share code, notes, and snippets.

@aharpole
aharpole / gist:3485302
Created August 27, 2012 03:36
Report this bug to Evernote!
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
@aharpole
aharpole / gist:5357667
Created April 10, 2013 19:25
an example of using an ActiveRecord transaction
ActiveRecord::Base.transaction do
PlaylistSong.delete(playlist_id:params[:playlist_id])
#<create the new PlaylistSong objects
end
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
def do_error_prone_thing
toss_peanut_and_try_catching_it_in_your_mouth
rescue PeanutNotCaught => e
casually_pretend_it_did_not_happen
end
@aharpole
aharpole / mailto-cash.html
Created December 12, 2013 22:05 — forked from veganstraightedge/mailto-cash.html
Sample mailto link to send me money
<a href="mailto:aharpole@gmail.com?cc=cash@square.com&subject=$1">Give Aaron some MONAY</a>
@aharpole
aharpole / empty_commit.sh
Last active January 2, 2016 21:59
an example of doing an empty commit
git commit —allow-empty -m 'Look ma, no diffs!'
@aharpole
aharpole / query.sql
Created January 11, 2014 05:43
Putting records at the front of a query result
select * from forum_topics where forum_id=42 order by (sticky_topic=true) desc
@aharpole
aharpole / rspec_predicate_matchers_1.rb
Created January 11, 2014 05:45
RSpec Predicate Matchers code snippet
def has_cookie?
true
end
@aharpole
aharpole / rspec_example.rb
Created January 11, 2014 05:46
rspec example
thing.should have_cookie
@aharpole
aharpole / test_missing_integer.rb
Created February 10, 2014 21:28
Fullscreen candidate Ruby exercise
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.