Skip to content

Instantly share code, notes, and snippets.

View gauravds's full-sized avatar
🚀
Focusing

Gaurav Sharma gauravds

🚀
Focusing
View GitHub Profile
@gauravds
gauravds / upload-to-appstore.sh
Last active August 29, 2015 14:27 — forked from jedi4ever/upload-to-appstore.sh
Command upload App/Ipa to the iTunes Connect App Store
#!/bin/bash
set -ex
# This scripts allows you to upload a binary to the iTunes Connect Store and do it for a specific app_id
# Because when you have multiple apps in status for download, xcodebuild upload will complain that multiple apps are in wait status
# Requires application loader to be installed
# See https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html
# Itunes Connect username & password
USER=bla
@gauravds
gauravds / String+AES.swift
Created October 26, 2015 09:01 — forked from yutelin/String+AES.swift
String+AES.swift
import Foundation
import CryptoSwift
extension String {
func aesEncrypt(key: String, iv: String) -> String {
let data = self.dataUsingEncoding(NSUTF8StringEncoding)
let enc = AES(key: key, iv: iv, blockMode:.CBC)?.encrypt(data!.arrayOfBytes(), padding: PKCS7())
let encData = NSData(bytes: enc!, length: Int(enc!.count))
let base64String: String = encData.base64EncodedStringWithOptions(NSDataBase64EncodingOptions(rawValue: 0));
@gauravds
gauravds / colors.py
Created January 25, 2016 09:11 — forked from arulrajnet/colors.py
python coloring for linux, based on this answer http://stackoverflow.com/a/26445590/3191896 and modified to make it more usable in a pythonic way.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Color(object):
"""
reference from https://gist.github.com/Jossef/0ee20314577925b4027f and modified bit.
"""
def __init__(self, text, **user_styles):
@gauravds
gauravds / colors.py
Created January 25, 2016 09:11 — forked from jossef/colors.py
python coloring for linux, based on this answer http://stackoverflow.com/a/26445590/3191896
def color(text, **user_styles):
styles = {
# styles
'reset': '\033[0m',
'bold': '\033[01m',
'disabled': '\033[02m',
'underline': '\033[04m',
'reverse': '\033[07m',
///
/// Author : Gaurav D. Sharma
/// Run on Swift 3.0
/// IBM swift sandbox : https://swiftlang.ng.bluemix.net/#/repl
///
//// Are you using ObjectMapper for model mapping in swift.
//// Object creation like Mapper<T>().map(jsonString)
//// And you are irritaed with the type name passing and syntex memorization
////
@gauravds
gauravds / CalculatorView.swift
Created July 20, 2016 06:23 — forked from natecook1000/CalculatorView.swift
An IBInspectable Calculator Construction Set
// CalculatorView.swift
// as seen in http://nshipster.com/ibinspectable-ibdesignable/
//
// (c) 2015 Nate Cook, licensed under the MIT license
/// The alignment for drawing an String inside a bounding rectangle.
enum NCStringAlignment {
case LeftTop
case CenterTop
case RightTop
@gauravds
gauravds / gist:2220ba5c6900f9c5adc4db1bf0980ce3
Created September 15, 2016 18:54 — 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.
@gauravds
gauravds / cert2pem
Created September 15, 2016 18:55
From raywenderlich.com
# 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.
@gauravds
gauravds / Model+AdditionalParam.h
Created November 29, 2016 21:23 — forked from sandeepsh3090/Model+AdditionalParam.h
Objective-C Object Association for JSON Model
@interface Model (AdditionalParam)
@property (nonatomic, strong) NSString <Optional> * new_key_name;
@end
@gauravds
gauravds / Crop.m
Created November 29, 2016 21:24 — forked from NarendraPunchh/Crop.m
- (void)setMaskImage {
CALayer *mask = [CALayer layer];
mask.contents = (id)[[UIImage imageNamed:@"infoLogo"] CGImage];
mask.frame = self.imgItem.bounds;
self.imgItem.layer.mask = mask;
self.imgItem.layer.masksToBounds = YES;
self.imgItem.contentMode = UIViewContentModeCenter;
}