Skip to content

Instantly share code, notes, and snippets.

View sauvikatinnofied's full-sized avatar

Sauvik Dolui sauvikatinnofied

View GitHub Profile
@sauvikatinnofied
sauvikatinnofied / TinyLoggerUsages.swift
Last active May 29, 2017 05:46
TinyLoggerUsages Medium Blog Post
Logger.log(message: "This is a DEBUG message", event: .d) // DEBUG log
Logger.log(message: "This is an ERROR message", event: .e) // ERROR log
Logger.log(message: "This is an INFO message", event: .i) // INFO log
Logger.log(message: "This is a VERBOSE message", event: .v) // VERBOSE log
Logger.log(message: "This is a WARNING message", event: .w) // WARNING log
Logger.log(message: "This is a SEVERE message", event: .s) // SEVERE Error log
// LOG ON XCODE CONSOLE
2017-05-13 12:56:34445 [💬][AppDelegate.swift]:20 19 application(_:didFinishLaunchingWithOptions:) -> This is a DEBUG message
2017-05-13 12:56:34463 [‼️][AppDelegate.swift]:21 19 application(_:didFinishLaunchingWithOptions:) -> This is an ERROR message
@sauvikatinnofied
sauvikatinnofied / ShimmerView.swift
Created April 11, 2017 19:41
List Load Showing Shimmer View
import UIKit
class ShimmerView: UIView {
var primaryColor: UIColor = UIColor(red: 214.0/255.0, green: 214.0/255.0, blue: 214.0/255.0, alpha: 1.0)
var animationColor: UIColor = .white
@sauvikatinnofied
sauvikatinnofied / PinterestHome.json
Created March 22, 2017 17:30
NetworkLibrary Test Response JSON
[
{
"id":"4kQA1aQK8-Y",
"created_at":"2016-05-29T15:42:02-04:00",
"width":2448,
"height":1836,
"color":"#060607",
"likes":12,
"liked_by_user":false,
"user":{
[{
"title": "Apple MacBook Pro MF839HN/A 13-inch Laptop (Core i5/8GB/128GB/OS X Yosemite/Intel Iris Graphics 6100)",
"desc": "A groundbreaking Retina display. Powerful dual-core and quad-core Intel processors. Fast flash storage. High-performance graphics. Great built-in apps. And now in the 13-inch model, a revolutionary new Force Touch trackpad and even longer battery life.1 Whatever you can imagine, MacBook Pro with Retina display gives you the power to create.",
"priceInUSDollar": 1290.0,
"imageURL": "http://ecx.images-amazon.com/images/I/61R5Fro8r3L._SL100_.jpg"
}, {
"title": "Apple Macbook Pro MD101HN/A 13-inch Laptop (Core i5/4GB/500GB/Mac OS Mavericks/Intel HD Graphics), Silver",
"desc": "The Apple Macbook Pro has a design that can only come from the artists at apple. The lightweight grey-white shiny finish with a simplistic apple logo is something that will turn heads wherever you go. The design uses lightweight but strong aluminium to make sure that your system weighs only 1.35kg to ensure tha
@sauvikatinnofied
sauvikatinnofied / gist:3f935b79108f794bff9353fb1a1722fe
Created January 18, 2017 17:39 — forked from kublaios/gist:f01cdf4369c86ddd6d71
Making a PEM File for iOS Push Notifications (From Ray Wenderlich's tutorial)
# Convert the .cer file into a .pem file:
$ openssl x509 -in aps_development.cer -inform der -out PushChatCert.pem
# Convert the private key’s .p12 file into a .pem file:
$ openssl pkcs12 -nocerts -in PushChatKey.p12 -out PushChatKey.pem
# Finally, combine the certificate and key into a single .pem file
$ cat PushChatCert.pem PushChatKey.pem > ck.pem
# At this point it’s a good idea to test whether the certificate works.
@sauvikatinnofied
sauvikatinnofied / MediumBlogFontHandling_FullCode.swift
Last active October 25, 2023 14:57
MediumBlogFontHandling_FullCode
import Foundation
import UIKit
// Usage Examples
let system12 = Font(.system, size: .standard(.h5)).instance
let robotoThin20 = Font(.installed(.RobotoThin), size: .standard(.h1)).instance
let robotoBlack14 = Font(.installed(.RobotoBlack), size: .standard(.h4)).instance
let helveticaLight13 = Font(.custom("Helvetica-Light"), size: .custom(13.0)).instance
struct Font {
@sauvikatinnofied
sauvikatinnofied / FontUsagesNew.swift
Created January 3, 2017 22:32
MediumBlogFontUsages8
let system12 = Font(.system, size: .standard(.h5)).instance
let robotoThin20 = Font(.installed(.RobotoThin), size: .standard(.h1)).instance
let robotoBlack14 = Font(.installed(.RobotoBlack), size: .standard(.h4)).instance
let helveticaLight13 = Font(.custom("Helvetica-Light"), size: .custom(13.0)).instance
@sauvikatinnofied
sauvikatinnofied / FontUsagesOldWay.swift
Last active January 3, 2017 22:30
MediumFontUsagesBlogGist6
let system12 = UIFont.systemFont(ofSize: 12.0) // Hard coded literals -> 1
let robotoThin20 = UIFont(name: "Roboto-Thin", size: 20.0) // Hard coded literals -> 2
let robotoBlack14 = UIFont(name: "Roboto-Black", size: 14.0) // Hard coded literals -> 2
let helveticaLight13 = UIFont(name: "Helvetica-Light", size: 13.0) // Hard coded literals -> 2
@sauvikatinnofied
sauvikatinnofied / FontWrapped2.swift
Last active January 3, 2017 22:54
MediumBlogPost_FontHandling_Gist_5
extension Font {
var instance: UIFont {
var instanceFont: UIFont!
switch type {
case .custom(let fontName):
guard let font = UIFont(name: fontName, size: CGFloat(size.value)) else {
fatalError("\(fontName) font is not installed, make sure it is added in Info.plist and logged with Utility.logAllAvailableFonts()")
}
instanceFont = font
case .installed(let fontName):
@sauvikatinnofied
sauvikatinnofied / FontWrapped1.swift
Last active January 3, 2017 22:53
MediumBlogPost_FontHandling_Gist_4
struct Font {
enum FontType {
case installed(FontName)
// ...
}
enum FontSize {
case standard(StandardSize)
// ...
}
enum FontName: String {