Skip to content

Instantly share code, notes, and snippets.

View KiranPanesar's full-sized avatar

Kiran Panesar KiranPanesar

View GitHub Profile
### Keybase proof
I hereby claim:
* I am kiranpanesar on github.
* I am k_panesar (https://keybase.io/k_panesar) on keybase.
* I have a public key ASByGzsAJQrCaws76P0ZOHn8Tt8OLxtFjPAfO4LDdCNMaAo
To claim this, I am signing this object:
@KiranPanesar
KiranPanesar / session.rb
Last active April 22, 2019 21:57 — forked from bnorton/session.rb
Skip the default Rails session (when building an API)
class ApplicationController < ActionController::Base
before_action :skip_session
private
def skip_session
if request.format == :json
request.session_options[:skip] = true
end
end
@KiranPanesar
KiranPanesar / NTVImageView.h
Created October 27, 2015 15:57
A UIImageView subclass which allows for external memers to set the intrinsicContentSize
//
// NTVImageView.h
//
// Created by kiran on 27/10/2015.
//
#import <UIKit/UIKit.h>
@interface NTVImageView : UIImageView
NSError *categoryError;
NSError *activationError;
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
BOOL successfulCategory = [audioSession setCategory:AVAudioSessionCategorySoloAmbient error:&categoryError];
BOOL successfulActivation = [audioSession setActive:YES error:&activationError];
NSLog(@"Category: Error: %@. Success: %@", categoryError, [NSNumber numberWithBool:successfulCategory]);
NSLog(@"Category: Error: %@. Success: %@", activationError, [NSNumber numberWithBool:successfulActivation]);
AVPlayerItem *item = [[AVPlayerItem alloc] initWithURL:[[NSBundle mainBundle] URLForResource:@"trax"
{
"user_id": 1231,
"body": {
// The values for the user that are to be changed.
}
}
@KiranPanesar
KiranPanesar / About JSON
Last active December 20, 2015 12:39
JSON object
{
"location": {
"lat": "23.02",
"lon": "20.1",
"title":"Da Hood"
},
"about_title": "About Us",
"description": "This is a small text piece about the user. It can be multiple lines blah blah",
"button": {
"title": "View Online",
-(void)updateReaderDocument:(ReaderDocument *)object {
// Remove all the subviews
[[self.view subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];
document = object; // Update the PDF document
[object updateProperties]; // Update the properties
[ReaderThumbCache touchThumbCacheWithGUID:object.guid]; // Reload thumb images
// Set up all subviews and trigger all other set up
[self viewDidLoad];