Skip to content

Instantly share code, notes, and snippets.

@howlingblast
howlingblast / Fonts.swift
Created July 11, 2017 14:23 — forked from feighter09/Fonts.swift
Set global font for iOS app in one place
// MARK: - Swizzling
extension UIFont {
class var defaultFontFamily: String { return "Georgia" }
override public class func initialize()
{
if self == UIFont.self {
swizzleSystemFont()
}
}
------ Debug phase ------
[ !! ] Unable to locate DeviceSupport directory containing DeveloperDiskImage.dmg.
[ !! ] Last path checked: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/Latest/DeveloperDiskImage.dmg
@howlingblast
howlingblast / gist:6011089
Created July 16, 2013 18:05
OpenFL Problem
Projects $ cd DisplayingABitmap/
DisplayingABitmap $ openfl test ios -simulator
Build settings from command line:
ARCHS = i386
PLATFORM_NAME = iphonesimulator
SDKROOT = iphonesimulator7.0
=== BUILD LEGACY TARGET Build Haxe OF PROJECT DisplayingABitmap WITH CONFIGURATION Release ===
Check dependencies
@howlingblast
howlingblast / gist:5966259
Created July 10, 2013 13:25
iOS: device pixel ratio / retina
if ([[UIScreen mainScreen] respondsToSelector:@selector(displayLinkWithTarget:selector:)] && [[UIScreen mainScreen] scale] == 2.0) {
_devicePixelRatio = 2.0; // retina display
}
else {
_devicePixelRatio = 1.0; // non-retina display
}
@howlingblast
howlingblast / gist:5814547
Created June 19, 2013 14:00
CoffeeScript: getter/setter example
Function::property = (prop, desc) ->
Object.defineProperty @prototype, prop, desc
class Person
constructor: (@firstName, @lastName) ->
@property 'fullName',
get: -> "#{@firstName} #{@lastName}"
set: (name) -> [@firstName, @lastName] = name.split ' '
p = new Person 'Leroy', 'Jenkins'