Skip to content

Instantly share code, notes, and snippets.

Avatar
🟡
Away

Harshad Kale kalehv

🟡
Away
View GitHub Profile
@kalehv
kalehv / client_secret.rb
Created Aug 25, 2019
Generate client secret for Sign in with Apple script
View client_secret.rb
# https://developer.okta.com/blog/2019/06/04/what-the-heck-is-sign-in-with-apple
# Fill in following details at the top of the file
require 'jwt'
key_file = 'key.txt'
team_id = ''
client_id = ''
key_id = ''
@kalehv
kalehv / firestore.rules
Created May 4, 2019
Firestore allow users access to only their data where top level collection has documents that match with Firebase uid
View firestore.rules
service cloud.firestore {
match /databases/{database}/documents {
match /{userId} {
allow read, write: if request.auth.uid == userId;
match /{document=**} {
allow read, write: if request.auth.uid == userId;
}
}
}
}
@kalehv
kalehv / ApiKey.swift
Last active Jun 19, 2020
Using iCloud for storing keys and then pushing into keychain of device.
View ApiKey.swift
import CloudKit
import Foundation
import Locksmith
/**
API Key used by this app is fetched from CloudKit. This class manages fetching and saving it into Keychain
*/
class ApiKey {
private static let RECORD_NAME = <# RECORD_NAME_IN_CLOUDKIT #>
private static let KEY = <# KEY_NAME_IN_CLOUDKIT #>
@kalehv
kalehv / Networking.swift
Last active Mar 22, 2019
Swift RESTful API Networking protocol with abstraction over Alamofire.
View Networking.swift
/*
This protocol provides way of making RESTful API calls using Alamofire but abstracts Alamofire from the consumer.
Conforming entity of this protocol only needs to provide essential data to make API call like BaseUrl, Path, Params etc
and make call to self.<# method #> within a GCD block.
Note that becuase os abstracion of Alamofire, the conforming entity does not need to know / care what netowrking framework is used.
Examlple: This class getches now playing movies from TMDB API using the following `Networking` protocol
class NowPlayingMoviesApi: Networking {
static var baseUrl: String = AppUrl.apiBaseUrl.rawValue
@kalehv
kalehv / swiftlint.yml
Created Jan 20, 2018
Sample SwiftLint configuration
View swiftlint.yml
included:
- todo-ios
excluded:
- todo-ios/Pods
- todo-iosTests
- todo-iosUITests
opt_in_rules:
- array_init
@kalehv
kalehv / android_naming_conventions.md
Last active Sep 13, 2020
Naming conventions for Android
View android_naming_conventions.md

Java / Kotlin code naming conventions

Strictly follow camelCase for Java/Kotlin names. I prefer simple readability and fluidity of code. Prefixing variables with m or s breaks that fluidity. I prefer not prefix my variables with m or s. If you really want to differentiate between parameters and local variables, prefer prefixing them with this. instead of m and Class. instead of s.

Logging tags should be named TAG and prefer static. No need to prefix TAG with Class.TAG.
private static final String TAG = <CurrentClass>.class.getSimpleName();
@kalehv
kalehv / keybase.md
Last active Oct 13, 2016
Verifying myself on keybase.io
View keybase.md

Keybase proof

I hereby claim:

  • I am kalehv on github.
  • I am kalehv (https://keybase.io/kalehv) on keybase.
  • I have a public key whose fingerprint is 3FEE 6F83 6507 17F0 4F24 A770 2127 923E 0E46 E6F4

To claim this, I am signing this object:

@kalehv
kalehv / color hex percentage
Last active Feb 24, 2017 — forked from daniellevass/android_material_design_colours.xml
Android Material Design Colours
View color hex percentage
100% — FF
99% — FC
98% — FA
97% — F7
96% — F5
95% — F2
94% — F0
93% — ED
92% — EB
91% — E8
@kalehv
kalehv / gitignore.py
Last active Aug 29, 2015
Python script that downloads contents of .gitignore file from https://github.com/github/gitignore for specified language / IDE. The name of the argument has to exactly match with the name on github repo. WARNING - the argument name is CASE-SENSITIVE Python 2.7
View gitignore.py
#!/usr/bin/env python
"""
gitignore.py:
This program searches for specified module on GitHub/gitignore repository.
If the file is found on github, it is downloaded and created in the current working directory.
This program creates .gitignore if it does not exist or overwrites if it does exist.
"""
@kalehv
kalehv / colors.xml
Last active Oct 13, 2020
Material Design Color Palette Colors.xml Resource file for Android
View colors.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
Google Material Design Color Palette for Android http://www.google.com/design/spec/style/color.html#color-ui-color-palette
Spreadsheet used to create this reosurce - http://bit.ly/mdcolor_spreadsheet
Link to this colors.xml resource file - http://bit.ly/mdcolorsxml
Harshad Kale
https://github.com/kalehv
-->
You can’t perform that action at this time.