Instantly share code, notes, and snippets.

View vscode.json
{
"editor.formatOnPaste": true,
"editor.fontLigatures": true,
"editor.minimap.enabled": false,
"editor.wordWrap": "on",
"files.autoSave": "onFocusChange",
"editor.tabCompletion": false,
"explorer.openEditors.visible": 0,
"editor.fontFamily": "Fira code, Monaco, 'Courier New', monospace",
"window.zoomLevel": 0,
View CenterCellCollectionViewFlowLayout.swift
class CenterCellCollectionViewFlowLayout: UICollectionViewFlowLayout {
var mostRecentOffset : CGPoint = CGPoint()
override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint {
if velocity.x == 0 {
return mostRecentOffset
}
View TypeFace.swift
//custom-dynamic-type.swift
protocol CustomDynamicTypeable {
func preferredFont(forTextStyle style: UIFontTextStyle) -> UIFont?
func font(forSize pointSize: CGFloat) -> UIFont?
}
// judson-enum.swift
enum JudsonFont: String, CustomDynamicTypeable {
case regular = "Judson-Regular"
case bold = "Judson-Bold"
View AppDelegateExtension.swift
private extension AppDelegate {
func configureAppStyling() {
styleNavigationBar()
styleBarButtons()
}
func styleNavigationBar() {
UINavigationBar.appearance().barTintColor = ColorPalette.ThemeColor
UINavigationBar.appearance().tintColor = ColorPalette.TintColor
View keybase.md

Keybase proof

I hereby claim:

  • I am sajadabedi on github.
  • I am sajjad (https://keybase.io/sajjad) on keybase.
  • I have a public key ASDxP6gUQtnKG8GtcYH0eh3qv8bL3RK_pDheGwe3gm8lKQo

To claim this, I am signing this object:

View UIFont+CustomFont.swift
import UIKit
extension UIFont {
class func systemFontOfSize(size: CGFloat) -> UIFont {
return UIFont(name: "CustomFont-Regular", size: size)!
}
func lightSystemFontOfSize(size: CGFloat) -> UIFont {
return UIFont(name: "CustomFont-Light", size: size)!
}
func boldSystemFontOfSize(size: CGFloat) -> UIFont {
View KeyboardAvoidable.swift
// KeyboardAvoidable
// Roy McKenzie
protocol KeyboardAvoidable: class {
func addKeyboardObservers(customBlock: ((CGFloat) -> Void)?)
func removeKeyboardObservers()
var layoutConstraintsToAdjust: [NSLayoutConstraint] { get }
}
var KeyboardShowObserverObjectKey: UInt8 = 1
View gist:635b8767aeae6a2400bd56d99eba81eb
// Creates a UIColor from a Hex string.
func colorWithHexString (hex:String) -> UIColor {
var cString:String = hex.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()).uppercaseString
if (cString.hasPrefix("#")) {
cString = cString.substringFromIndex(1)
}
if (countElements(cString) != 6) {
return UIColor.grayColor()
View .gitconfig
[user]
name = Sajad
email = sajadxabedi@gmail.com
[core]
autocrlf = input
[alias]
# short aliases
st = status