Skip to content

Instantly share code, notes, and snippets.

@jsooriah
jsooriah / books.md
Created May 25, 2020 10:29 — forked from abstractart/books.md
Free Programming Ebooks - O'Reilly Media. Codeship free ebooks here - https://bit.ly/2oQ0knQ
@jsooriah
jsooriah / iOS-UploadImage.h
Created October 24, 2015 13:12 — forked from mombrea/iOS-UploadImage.h
example of a multi-part form post in objective-c
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"REST URL PATH"]];
NSData *imageData = UIImageJPEGRepresentation(image, 1.0);
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
[request setHTTPShouldHandleCookies:NO];
[request setTimeoutInterval:60];
[request setHTTPMethod:@"POST"];
NSString *boundary = @"unique-consistent-string";
@jsooriah
jsooriah / UINavigationController+Fade.h
Created October 2, 2015 12:51 — forked from ksm/UINavigationController+Fade.h
UINavigationController custom pop/push transition animation
/*
Copied and pasted from David Hamrick's blog:
Source: http://www.davidhamrick.com/2011/12/31/Changing-the-UINavigationController-animation-style.html
*/
@interface UINavigationController (Fade)
- (void)pushFadeViewController:(UIViewController *)viewController;
- (void)fadePopViewController;
{
"id": 27,
"description": "Raviver la flamme, c est mettre du piment dans sa vie de couple. Savez vous le surprendre ? Faîtes le test !",
"urlKey": "/api/v1/fr/tests/27",
"title": "Savez-vous le surprendre?",
"target_sex": "",
"credits": 15,
"logo": "",
"pictureURL": "/images/img_atoutsSeduction.png",
"score_based": false,
{
"id": 27,
"description": "Raviver la flamme, c est mettre du piment dans sa vie de couple. Savez vous le surprendre ? Faîtes le test !",
"urlKey": "/api/v1/fr/tests/27",
"title": "Savez-vous le surprendre?",
"target_sex": "",
"credits": 15,
"logo": "",
"pictureURL": "/images/img_atoutsSeduction.png",
"score_based": false,
- (void)decomposeFlightsPerHour {
self.decomposedFlights = [NSMutableDictionary dictionary];
NSMutableArray *temp = [NSMutableArray array];
NSString *currentHourPrefix = [[[self.flightList objectAtIndex:0] objectForKey:@"HP"] substringToIndex:2];
NSString *dateHourPrefix = [[[self.flightList objectAtIndex:0] objectForKey:@"DATEVOL"] substringToIndex:10];
NSString *newPrefix = [NSString stringWithFormat:@"%@_%@", dateHourPrefix, currentHourPrefix];
for (NSDictionary *flightInfo in self.flightList) {
- (NSArray *)fetchPopularSearches {
__block NSMutableArray *result = [NSMutableArray array];
NSString *searchQuery = [NSString stringWithFormat:@"url_to_flights_json"];
NSURL *url = [[NSURL alloc] initWithString:searchQuery];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request
success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON)
{
- (void)preparePushConfigurationParams {
NSMutableDictionary *finalParamsDict = [NSMutableDictionary dictionary];
NSArray *temp = [self.selectedTeamsForNews arrayByAddingObjectsFromArray:self.selectedTeamsForPush];
NSMutableDictionary *finalDict = [NSMutableDictionary dictionary];
for (FMTeam *aTeam in temp) {
NSMutableDictionary *aDict = [NSMutableDictionary dictionary];
BOOL configure_for_push = [self.selectedTeamsForPush containsObject:aTeam];
BOOL configure_for_news = [self.selectedTeamsForNews containsObject:aTeam];
[aDict setObject:[NSNumber numberWithInt:aTeam.fm_team_id] forKey:@"fm_team_id"];
class Api::V1::SessionsController < Devise::SessionsController
prepend_before_filter :require_no_authentication, :only => [:create]
skip_before_filter :verify_authenticity_token, :if => Proc.new { |c| c.request.format == 'application/json' }
before_filter :validate_auth_token, :except => :create
include Devise::Controllers::Helpers
include ApiHelper
respond_to :json
def create
resource = User.find_for_database_authentication(:email => params[:user][:email])
@jsooriah
jsooriah / JS.js
Created November 12, 2012 17:36 — forked from mnmly/JS.js
// Page init code is at the bottom
var Map = (function(map, $){
var exports = map || {};
var geo = new google.maps.Geocoder(),
geocode = {
address: [ config.project_location.street,
config.project_location.city,
config.project_location.country].join(", ")