Skip to content

Instantly share code, notes, and snippets.


Vaghula krishnan vaghul

View GitHub Profile
darcwader / resize-vi.swift
Created August 31, 2016 08:46
Resize Image using vImage
View resize-vi.swift
extension UIImage {
func resizeVI(size:CGSize) -> UIImage? {
let cgImage = self.CGImage!
var format = vImage_CGImageFormat(bitsPerComponent: 8, bitsPerPixel: 32, colorSpace: nil,
bitmapInfo: CGBitmapInfo(rawValue: CGImageAlphaInfo.First.rawValue),
version: 0, decode: nil, renderingIntent: CGColorRenderingIntent.RenderingIntentDefault)
var sourceBuffer = vImage_Buffer()
defer { * Int(sourceBuffer.height) * 4)
darcwader / resize-ui.swift
Created August 30, 2016 02:26
Resizing Image using UIKit
View resize-ui.swift
extension UIImage {
func resizeUI(size:CGSize) -> UIImage? {
UIGraphicsBeginImageContextWithOptions(size, true, self.scale)
self.drawInRect(CGRect(origin: CGPointZero, size: size))
let resizedImage = UIGraphicsGetImageFromCurrentImageContext()
return resizedImage
andreif / AppDelegate.swift
Created March 16, 2016 22:15
Example of UIPageViewController without storyboard i.e. created programmatically
View AppDelegate.swift
// derived from
import UIKit
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window!.rootViewController = ViewController()
noelrocha / open_app.html
Created March 16, 2015 18:28
Open app on Google Play or AppStore
View open_app.html
<!DOCTYPE html>
<meta charset="UTF-8">
<title>Open App</title>
URL Params:
customSchemeURL: Your custom scheme app
kublaios / gist:f01cdf4369c86ddd6d71
Created June 27, 2014 06:46
Making a PEM File for iOS Push Notifications (From Ray Wenderlich's tutorial)
View gist:f01cdf4369c86ddd6d71
# 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.