Skip to content

Instantly share code, notes, and snippets.

View raunakp's full-sized avatar

Raunak Poddar raunakp

  • SAP Labs
  • Bengaluru
View GitHub Profile
@raunakp
raunakp / resume.json
Last active April 5, 2024 18:27
json resume autogenerate
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"meta": {
"theme": "macchiato",
"themeOptions": {
"colors": {
"background": ["#ffffff", "#191e23"],
"dimmed": ["#f3f4f5", "#23282d"],
"primary": ["#191e23", "#fbfbfc"],
"secondary": ["#6c7781", "#ccd0d4"],
@raunakp
raunakp / AutoUpdatingTimeElapsedLabel.swift
Created September 3, 2019 10:25
a UILabel subclass that automatically updates elapsed time (eg: 1 month 2 weeks ago)
//
// AutoUpdatingTimeElapsedLabel.swift
//
// Created by Raunak Poddar on 03/09/19.
//
import UIKit
@objc class AutoUpdatingTimeElapsedLabel: UILabel {
@raunakp
raunakp / TimeInterval+playbackString.swift
Last active September 1, 2019 10:13
TimeInterval+playbackString.swift
extension TimeInterval {
var playbackString: String {
if self.isNaN {
return "??"
}
var seconds = self
var mins = Int((seconds / 60).rounded(.down))
seconds = seconds.truncatingRemainder(dividingBy: 60)
import Foundation
// Create TimeZone instance from UTC offset string like "-07:30"
extension TimeZone {
private static let refZoneString = "+0000"
private static var _offsetTimezoneDateFormatter: DateFormatter!
static var offsetTimezoneDateFormatter: DateFormatter {
if let _offsetTimezoneDateFormatter = _offsetTimezoneDateFormatter {
@raunakp
raunakp / PrettyDebugPrintable
Created July 21, 2019 06:08
pretty print nested composite object graph confirming to CustomDebugStringConvertible protocol
import Foundation
class StringUtils {
static func appendIfValuePresent(key: String, value: AnyHashable?, toArray array: inout [String], separator: String = ": ") {
if let value = value {
array.append("\(key)\(separator)\(value)")
}
}
}
@raunakp
raunakp / PrettyDebugPrintable
Created July 21, 2019 06:08
pretty print nested composite object graph confirming to CustomDebugStringConvertible protocol
import Foundation
class StringUtils {
static func appendIfValuePresent(key: String, value: AnyHashable?, toArray array: inout [String], separator: String = ": ") {
if let value = value {
array.append("\(key)\(separator)\(value)")
}
}
}
import Foundation
import CoreLocation
extension FloatingPoint {
var degreesToRadians: Self { return self * .pi / 180 }
var radiansToDegrees: Self { return self * 180 / .pi }
}
extension CLLocationCoordinate2D {
func coordinate(atDistance distanceInKm: Double, atBearingDegrees bearingDegrees: Double) -> CLLocationCoordinate2D {
var moment = require('moment-timezone')
var assert = require('assert')
function convertCustomDateFormat1 (dateStr) {
/*
timeStamp: "21Sep18-23:24:33",
To
2018-09-21 23:24:33.49+00
*/
var event = moment.tz(dateStr, 'DMMMYY-HH:mm:ss.SS', 'UTC')
@raunakp
raunakp / LICENSE.md
Last active August 29, 2015 14:16 — forked from s4y/LICENSE.md

Copyright (c) 2010 DeepTech, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE O

@raunakp
raunakp / gist:7638557
Last active December 29, 2015 07:49
Dynamically change UIView for UITableView section header
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 13)];
label.textColor = [UIColor blueColor];
label.text = [NSString stringWithFormat:@"%d", section];
label.tag = 100 + section;
return label;
}
/*