Skip to content

Instantly share code, notes, and snippets.

View aldo-jlaurenstin's full-sized avatar

James Laurenstin aldo-jlaurenstin

  • ALDO
  • Montreal, Quebec, Canada
View GitHub Profile
@A-Zak
A-Zak / uiimage_combine.swift
Last active October 30, 2021 09:11
UIImage extension to combine two images
extension UIImage {
class func imageByCombiningImage(firstImage: UIImage, withImage secondImage: UIImage) -> UIImage {
let newImageWidth = max(firstImage.size.width, secondImage.size.width )
let newImageHeight = max(firstImage.size.height, secondImage.size.height)
let newImageSize = CGSize(width : newImageWidth, height: newImageHeight)
UIGraphicsBeginImageContextWithOptions(newImageSize, false, UIScreen.mainScreen().scale)
@aldo-jlaurenstin
aldo-jlaurenstin / MakeTransparentHoleOnOverlayView.swift
Last active December 20, 2023 14:40
Make a Transparent Hole on an Overlay UIView
//
// MakeTransparentHoleOnOverlayView.swift
//
// Created by James Laurenstin on 2015-04-10.
// Copyright (c) 2015 Aldo Group Inc. All rights reserved.
//
import UIKit
class MakeTransparentHoleOnOverlayView: UIView {
@vparihar01
vparihar01 / addEffect.swift
Created July 6, 2015 11:15
swift Blur, Vibrant and Vibrancy
// Blur Effect
var blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark)
var blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = view.bounds
view.addSubview(blurEffectView)
// Vibrancy Effect
var vibrancyEffect = UIVibrancyEffect(forBlurEffect: blurEffect)
var vibrancyEffectView = UIVisualEffectView(effect: vibrancyEffect)
vibrancyEffectView.frame = view.bounds
@pyrtsa
pyrtsa / Profiling.swift
Last active October 28, 2016 18:27
Profile a block of code in Swift 2.0
import Foundation
public func profiling<R>(label: String, @noescape _ block: () -> R) -> R {
NSLog("*** %@...", label)
let start = NSDate()
defer {
let end = NSDate()
NSLog("*** %@ took %5.3g seconds", label, end.timeIntervalSinceDate(start))
}
return block()
@mbinna
mbinna / podforceupdate.sh
Created December 4, 2012 09:43
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update