Skip to content

Instantly share code, notes, and snippets.

View vikitripathi's full-sized avatar

Abhishek Dutt vikitripathi

  • Bangalore
View GitHub Profile
@vikitripathi
vikitripathi / Event.swift
Created January 26, 2018 21:47 — forked from ryuichis/Event.swift
Swift 3 Struct & NSCoding
public struct Event {
public internal(set) var timeStamp: Date
public internal(set) var eventTag: String
public init(timeStamp: Date, tag: String) {
self.timeStamp = timeStamp
self.eventTag = tag
}
}
class City: NSObject, NSCoding
{
var name: String?
var id: Int?
required init?(coder aDecoder: NSCoder)
{
self.name = aDecoder.decodeObject(forKey: "name") as? String
self.id = aDecoder.decodeObject(forKey: "id") as? Int
}
@vikitripathi
vikitripathi / UINavigationController+Fade.h
Created June 2, 2017 06:06 — 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;
@vikitripathi
vikitripathi / anorm.scala
Created May 11, 2017 23:23 — forked from davegurnell/anorm.scala
A short guide to Anorm
/*
Overview
--------
To run a query using anorm you need to do three things:
1. Connect to the database (with or without a transaction)
2. Create an instance of `anorm.SqlQuery` using the `SQL` string interpolator
3. Call one of the methods on `SqlQuery` to actually run the query
@vikitripathi
vikitripathi / install_spark.md
Created February 24, 2017 11:44 — forked from fspaolo/install_spark.md
Install Apache Spark

Install Apache Spark (OSX 10.6)

You need the package manager Homebrew (if not installed), see http://brew.sh/

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Get Spark 'Source Code':

http://spark.apache.org/downloads.html
@vikitripathi
vikitripathi / delay.m
Created January 7, 2017 18:11
dispatch_after a delay
- (void)signInWithUsername:(NSString *)username password:(NSString *)password complete:(RWSignInResponse)completeBlock {
double delayInSeconds = 2.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
BOOL success = [username isEqualToString:@"user"] && [password isEqualToString:@"password"];
completeBlock(success);
});
}
@vikitripathi
vikitripathi / fetchThingsWithCompletion.m
Created October 3, 2016 12:45 — forked from quellish/fetchThingsWithCompletion.m
Pseudo-sample of a core data fetch with a completion block.
- (void) fetchThingsWithCompletion:(void (^)(NSArray *, NSError *))completion{
[context performBlock:^{
result = [context executeFetch:...
if (completion != nil){
completion(result, error);
}
}];
}
@vikitripathi
vikitripathi / launch_sublime_from_terminal.markdown
Created July 27, 2016 08:27 — forked from artero/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

controllers.controller('MainCtrl', function($scope, $location, Facebook, $rootScope, $http, $location, Upload, Auth, User, Question, Category, Serie, Record, Location, Popup, Process, Card, Question) {
$scope.$on('authLoaded', function() {
$scope.isExpert($scope.main.serieId);
$scope.isMember($scope.main.serieId);
});
$scope.loadAuth = function() {
Auth.load().success(function(data) {
$scope.main.user = data.user;
$scope.$broadcast("authLoaded");
@vikitripathi
vikitripathi / Notification
Created July 7, 2015 09:59
To notify user of any event use JGrowl : a jquery plugin
<!DOCTYPE html>
<html>
<head>
<title>jGrowl</title>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jquery-jgrowl/1.2.12/jquery.jgrowl.min.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-jgrowl/1.2.12/jquery.jgrowl.min.js"></script>
<script type="text/javascript">
(function($){
$(function(){