Skip to content

Instantly share code, notes, and snippets.

@iamjason
iamjason / video_export_image
Created May 14, 2013 02:26
Export Single Image From Video Using ffmpeg
ffmpeg -i input.mp4 -ss 0:00:00.000 -qscale 0 -vframes 1 output.jpg
@iamjason
iamjason / iOS Swift print all font names
Created September 12, 2014 16:13
Prints out all of the Fonts available. (Helpful for using custom fonts)
for familyName in UIFont.familyNames() as [String] {
println("\(familyName)")
for fontName in UIFont.fontNamesForFamilyName(familyName) as [String] {
println("\tFont: \(fontName)")
}
}
@iamjason
iamjason / UIImage+Tinting.swift
Last active December 10, 2019 21:59
Swift UIImage extension for tinting images
/**
Usage:
let originalImage = UIImage(named: "cat")
let tintedImage = originalImage.tintWithColor(UIColor(red: 0.9, green: 0.7, blue: 0.4, alpha: 1.0))
*/
extension UIImage {
func tintWithColor(color:UIColor)->UIImage {
//
// ViewController.swift
// AlamofireExample
//
// Created by Jason Garrett on 10/2/14.
// Copyright (c) 2014 jg. All rights reserved.
//
import UIKit
import Alamofire
@iamjason
iamjason / xcode-git-build=number
Created October 29, 2014 23:10
XCode 6 - Script to sync number of GIT commits to the Build Number
#!/bin/bash
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$(git rev-list HEAD | wc -l | tr -d ' ')
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
@iamjason
iamjason / gist:83b231258aaaa179b70c
Created November 16, 2014 20:04
APNS .pem command line
openssl pkcs12 -in forum-prod.p12 -out forum-prod.pem -nodes -clcerts
@iamjason
iamjason / TableViewDataManager.swift
Last active August 29, 2015 14:09
Swift TableView Data Manager
//
// Created by Jason Garrett on 10/21/14.
// Copyright (c) 2014 Jason Garrett. All rights reserved.
//
import UIKit
class TableViewDataManager : NSObject, UITableViewDataSource, UITableViewDelegate {
weak var vcDelegate:UIViewController!
var tableView:UITableView!
@iamjason
iamjason / gist:8457cf00a34e3cf0844c
Last active August 29, 2015 14:11
polygon rounded path + image mask
// Playground - noun: a place where people can play
import UIKit
import XCPlayground
class RoundedPolygonImageView : UIImageView {
let maskLayer = CAShapeLayer()
let borderLayer = CAShapeLayer()
@iamjason
iamjason / JGCell.swift
Created December 16, 2014 20:39
Generic UITableViewCell Implementation (swift)
class JGCell : UITableViewCell {
override init(style: UITableViewCellStyle, reuseIdentifier: String!) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupViews()
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
@iamjason
iamjason / us-states-array
Created December 29, 2014 01:31
Swift US States Array
let state = [ "AK - Alaska",
"AL - Alabama",
"AR - Arkansas",
"AS - American Samoa",
"AZ - Arizona",
"CA - California",
"CO - Colorado",
"CT - Connecticut",
"DC - District of Columbia",
"DE - Delaware",