Skip to content

Instantly share code, notes, and snippets.

View arisro's full-sized avatar
👻

Aris Buzachis arisro

👻
View GitHub Profile
@arisro
arisro / jscampro.md
Last active August 29, 2015 14:02
JSCampRO
original_js = File.binread("app/assets/javascripts/application.js")
if original_js.include?("require 'my_engine'")
say_status("skipped", "insert into app/assets/javascripts/application.js", :yellow)
else
insert_into_file "app/assets/javascripts/application.js", :after => %r{//= require ['"]?jquery['"]?} do
"\n//= require 'my_engine'\n\n"
end
end
// dataArray is the nsdictionary/array containing you list of names; we take the 1st letter of each, and compare it with the title of the Index the user "clicked" on
// we cycle through all your names until we find a name starting with the letter that he touched in the index. When we found the name, we scroll the table tot that row.
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
for (int i = 0; i< [dataArray count]; i++) {
NSString *letterString = [[dataArray objectAtIndex:i] substringToIndex:1];
if ([letterString isEqualToString:title]) {
[tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
break;
}