Skip to content

Instantly share code, notes, and snippets.

View chashmeetsingh's full-sized avatar
👨‍💻
/* No Comment */

Chashmeet Singh chashmeetsingh

👨‍💻
/* No Comment */
View GitHub Profile
import UIKit
import SpriteKit
import ParticlesLoadingView
class ViewController: UIViewController {
lazy var loadingView: ParticlesLoadingView = {
let x = UIScreen.mainScreen().bounds.size.width / 2 - (75 / 2) - 200
let y = UIScreen.mainScreen().bounds.size.height / 2 - (75 / 2)
let view = ParticlesLoadingView(frame: CGRect(x: x, y: y, width: 75, height: 75))
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let navigationController: AppNavigationController = AppNavigationController(rootViewController: VideoViewController())
let menuViewController: AppMenuController = AppMenuController(rootViewController: navigationController)
menuViewController.edgesForExtendedLayout = .None
let tabBarController: BottomNavigationController = BottomNavigationController()
tabBarController.viewControllers = [RecipesViewController(), menuViewController, PhotoViewController()]
tabBarController.selectedIndex = 1
tabBarController.tabBar.tintColor = MaterialColor.white
@chashmeetsingh
chashmeetsingh / timeago.swift
Created August 2, 2016 01:08
"Time ago" function for Swift (based on MatthewYork's DateTools for Objective-C) *Swift 3
func timeAgoSinceDate(date:NSDate, numericDates:Bool) -> String {
let calendar = Calendar.current
let now = NSDate()
let earliest = now.earlierDate(date as Date)
let latest = (earliest == now) ? date : now
let components:NSDateComponents = calendar.components([Calendar.Unit.minute , Calendar.Unit.hour , Calendar.Unit.day , Calendar.Unit.weekOfYear , Calendar.Unit.month , Calendar.Unit.year , Calendar.Unit.second], from: earliest, to: latest as Date, options: Calendar.Options())
if (components.year >= 2) {
return "\(components.year) years ago"
} else if (components.year >= 1){
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "jp.ogwork.freetransform"
minSdkVersion 15
targetSdkVersion 24
List<NameValuePair> someVariable = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("query", "{articles{id}}"));
HttpClient httpclient=new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://udacity-alumni-api.herokuapp.com/graphql");
httppost.setHeader(HTTP.CONTENT_TYPE,"application/x-www-form-urlencoded;charset=UTF-8");
try {
httppost.setEntity(new UrlEncodedFormEntity(someVariable, "UTF-8"));
} catch (UnsupportedEncodingException e) {
@chashmeetsingh
chashmeetsingh / only_choice
Last active May 19, 2017 09:08
only_choice
from utils import *
def only_choice(values):
for unit in unitlist:
for box in unitlist:
val = ''
for item in box:
if len(values[item]) > 1:
val += values[item]
s = ''
def naked_twins(values):
"""Eliminate values using the naked twins strategy.
Args:
values(dict): a dictionary of the form {'box_name': '123456789', ...}
Returns:
the values dictionary with the naked twins eliminated from peers.
"""
twins = []
//
// NewModel.swift
// Susi
//
// Created by Chashmeet Singh on 2017-06-08.
// Copyright © 2017 FOSSAsia. All rights reserved.
//
import RealmSwift
import Realm
@chashmeetsingh
chashmeetsingh / GSoC 2017 Final Submission Report.md
Last active September 2, 2017 22:20
GSoC 2017 Final Submission Report

Google Summer of Code 2017 Final Submission Report

Aim

The main aim of this project was to develop an iOS app on top of the SUSI.AI Server functionalities. The server makes use of different skills which are defined in the Skill Data Repository. The app will have functionalities such as replying intelligently to user's queries, helping users in their day to day lives, hot word detection, and training, synchronizing settings across all the clients and much more.

//
// DrawerViewController.swift
// GPS Info
//
// Created by Chashmeet Singh on 16/03/18.
// Copyright © 2018 Chashmeet Singh. All rights reserved.
//
import UIKit
import KYDrawerController