Skip to content

Instantly share code, notes, and snippets.

View amarjitdhillon's full-sized avatar
🎯
Focusing

Amarjit Singh Dhillon amarjitdhillon

🎯
Focusing
View GitHub Profile
space is imp
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
// Override point for customization after application launch.
return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
let handled = FBSDKApplicationDelegate.sharedInstance().application(app, open: url, sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String! , annotation: options[UIApplicationOpenURLOptionsKey.annotation])
return handled
}
import UIKit
import FBSDKLoginKit
class loginViewController: UIViewController , FBSDKLoginButtonDelegate {
override func viewDidLoad() {
public class writeToCassandra {
private static Session session;
private static Cluster cluster;
private static final String CREATE_KEYSPACE_QUERY = "CREATE KEYSPACE data WITH replication= {'class':'SimpleStrategy', 'replication_factor':1};";
private static final String createTable = "CREATE TABLE test.patient(id int, heart_rate int, PRIMARY KEY(id));" ;
public static void main(String[] args) throws Exception {
\documentclass[letterpaper,12pt,titlepage,final]{report}
\setlength{\marginparwidth}{0pt} % Please customize the margins as per your need
\setlength{\marginparsep}{0pt} % width of space between body text and margin notes
\setlength{\evensidemargin}{0.125in}
\setlength{\oddsidemargin}{0.125in}
\setlength{\textwidth}{6.375in}
\raggedbottom
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{subfig}
@amarjitdhillon
amarjitdhillon / highlight.html
Created August 5, 2019 06:48
Bootstrap class to highlight text
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
</head>
@amarjitdhillon
amarjitdhillon / group-anagrams.py
Created February 7, 2022 01:58
Group Anagrams
class Solution:
def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
if len(strs) == 0:
return []
c_dict = {}
for word in strs:
freq_list = [0]*26
@amarjitdhillon
amarjitdhillon / longest-common-prefix.py
Created February 7, 2022 02:06
Longest Common Prefix Leetcode
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
res = '' # final output
if len(strs) == 0: # special case
return res
min_element = min(strs, key = len) # find the min length word in strs
for i in range(len(min_element)):
@amarjitdhillon
amarjitdhillon / 3sum.py
Created February 7, 2022 02:09
3 sum problem
class Solution:
def threeSum(self, nums: List[int]) -> List[List[int]]:
# special case
if len(nums) <= 2:
return []
result = set() # result will contain the unique tuples
nums = sorted(nums) # nlog(n) complexity