Skip to content

Instantly share code, notes, and snippets.

View jarinudom's full-sized avatar

Jarin Udom jarinudom

View GitHub Profile
require 'active_support'
module ImageUtils
extend ActiveSupport::Concern
module ClassMethods
def clean_up
puts "Cleaning up"
end
end
@jarinudom
jarinudom / keybase.md
Created May 23, 2014 18:10
keybase.md

Keybase proof

I hereby claim:

  • I am jarinudom on github.
  • I am jarin (https://keybase.io/jarin) on keybase.
  • I have a public key whose fingerprint is AC71 505E D744 86D3 1C1D D563 E361 687C FD76 4195

To claim this, I am signing this object:

@jarinudom
jarinudom / gist:d1b84a318e471989c2ef
Created April 17, 2015 16:11
Github quick submit
$(document).onFocusedKeydown(".js-quick-submit", function() {
return function(t) {
var e, n;
return "ctrl+enter" === t.hotkey || "meta+enter" === t.hotkey ? (n = $(this).closest("form"), e = n.find("input[type=submit], button[type=submit]").first(), e.prop("disabled") || n.submit(), !1) : void 0
}
})
[_exploreTableView beginUpdates];
// Remove Users
NSUInteger count=[_dataArray count];
for(int i=max_val;i<count;i++) {
[_dataArray removeObjectAtIndex:[users count]];
if(_selectedView==kExploreUsersView && _exploreTableView) {
[uiView deleteRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:(max_val+2) inSection:0]] withRowAnimation:kDefaultDeleteAnimation];
}
// In cellForRowAtIndexPath
static NSString *CellIdentifier = @"MyCustomCell";
MyCustomCell *cell = (MyCustomCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *topLevelObjects = [[NSBundle mainBundle]
loadNibNamed:@"MyCustomCell"
owner:nil options:nil];
- (void)scrollViewDidEndDecelerating:(UITableView *)tv {
if([tv isKindOfClass:[UITableView class]]) {
// do some stuff
}
}
- (void)scrollViewDidEndDragging:(UITableView *)tv willDecelerate:(BOOL)decelerate {
if ([tv isKindOfClass:[UITableView class]] && !decelerate) {
// do some stuff
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView cellForRowAtIndexPath:indexPath].image = nil;
}
# xcode noise
build
*.pbxuser
*.mode1v3
*.mode2v3
*.swp
*~.nib
*.perspective
*.perspectivev3
# users/index
def index
if current_user
@search = User.visible.without_user(current_user).search(params[:search])
else
@search = User.visible.search(params[:search])
end
MPMoviePlayerController* moviePlayer = [[MPMoviePlayerController alloc]
initWithContentURL:someUrl];
moviePlayer.movieControlMode = MPMovieControlModeHidden;
[moviePlayer play];
NSArray* windows = [[UIApplication sharedApplication] windows];
if ([windows count] > 1) {
UIWindow *moviePlayerWindow = [[UIApplication sharedApplication] keyWindow];
[moviePlayerWindow addSubview:yourCustomOverlayView];
}