This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIImage { | |
convenience init?(color: UIColor, size: CGSize = CGSize(width: 1.0, height: 1.0)) { | |
let image = UIGraphicsImageRenderer(size: size).image { context in | |
color.setFill() | |
context.fill(CGRect(origin: .zero, size: size)) | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public func zip<A>(_ arrays: [[A]]) -> ZipArrayCollection<A> { | |
return ZipArrayCollection(arrays) | |
} | |
public struct ZipArrayCollection<A>: Collection { | |
private let arrays: [[A]] | |
public let startIndex: Int | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## hoonsay.sed - Daniel Clelland 2016 | |
## List of regular expressions for converting Hoon to a phonetic representation | |
## | |
## Recommended usage: | |
## | |
## sed -E -f hoonsay.sed file.hoon > file.txt # Saves contents of hoon.hoon into hoon.txt | |
## cat hoon.txt | say -o hoon.aiff # Renders hoon.txt using the OS X speech to text engine | |
## | |
## Sample output, the add function from chapter 2a in hoon.hoon: | |
## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The character we are going to check*/ | |
NSString *character = @"字"; | |
/* Turn it into a character set ahead of our comparison */ | |
NSCharacterSet *characterSet = [NSCharacterSet characterSetWithCharactersInString:character]; | |
/* Fetch the system fallback font, as [UIFont familyNames] won't include it */ | |
UIFontDescriptor *fallbackFontDescriptor = [UIFont fontWithName:@".PhoneFallBack" size:12.0f].fontDescriptor; | |
/* Start with the fallback font's character set */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################### | |
# ENVIRONMENT CONFIG # | |
###################### | |
# Custom prompt | |
GIT_PS1_SHOWDIRTYSTATE=1 | |
PS1='\[\e[00;34m\]\u:\[\e[00m\] \[\e[00;33m\]\w \$\[\e[00m\]$(__git_ps1 " \[\e[00;35m\](%s)\[\e[00m\]")\[\033[00m\] ' | |
PS2='\[\e[00;33m\]> \[\e[00m\]' |