View gist:b0b78779ddc08edd637b
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
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | |
switch (indexPath.section) { | |
case 0: | |
{ | |
switch (indexPath.row) { | |
case 0: | |
{ | |
// yo dawg, i heard you like switch statements | |
} | |
} |
View LocalStore.rb
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
class LocalStore | |
def self.increase_popularity(model_class_name, model_id) | |
key = key(model_class_name) | |
REDIS.pipelined do | |
ensure_ttl(key) | |
REDIS.zincrby(key, 1, model_id) | |
end | |
end |
View resurrect_eratosthenes.rb
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
class Sieve | |
attr_reader :unmarked, :primes | |
def initialize(max) | |
@unmarked = (2..max).to_a | |
@primes = [] | |
resurrect_eratosthenes | |
end |