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
// TheAbyss.h | |
+ (NSString *)greetingMessageFromTheOtherworld; | |
// TheAbyss.m | |
+ (NSString *)greetingMessageFromTheOtherworld { | |
return nil; | |
} | |
// LonesomeWanderer.swift | |
TheAbyss.greetingMessageFromTheOtherworld().isEmpty |
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 { | |
// colorize image with given tint color | |
// this is similar to Photoshop's "Color" layer blend mode | |
// this is perfect for non-greyscale source images, and images that have both highlights and shadows that should be preserved | |
// white will stay white and black will stay black as the lightness of the image is preserved | |
func tint(tintColor: UIColor) -> UIImage { | |
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 Foundation | |
struct Song { | |
let title: String | |
let length: Float | |
func withAddedAdvertisement() -> Song { | |
return Song(title: self.title + " plus commercial", length: self.length + 10) | |
} | |
} |
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 Foundation | |
struct Song { | |
var title: String | |
var length: Float | |
mutating func addAdvertisement() { | |
self.title += " plus commercial" | |
self.length += 10 | |
} |
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
//some time, frc section may be need section offset | |
@objc public protocol MFetchedResultsControllerOffsetSectionDelegate{ | |
func offsetSection() -> Int | |
} | |
class MFetchedResultsController: NSFetchedResultsController, NSFetchedResultsControllerDelegate { | |
weak var viewController: UIViewController? //UITableViewController UICollectionViewController | |
weak var scrollView: UIScrollView? //TableView CollectionView | |
weak var offsetSectionDelegate: MFetchedResultsControllerOffsetSectionDelegate? |
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
#!/bin/bash | |
set -x | |
cd ${0%/*}/.. | |
# codesigning and choosing of provisioning profile is configured via project settings and is dependent of build config | |
: ${BUILD_NUMBER:?"Need to set BUILD_NUMBER"} | |
WORKSPACE=<yourworkspace>.xcworkspace |
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
- (NSString *)currentGregorianISO8601Date { | |
NSDate *requestDate = [NSDate date]; | |
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"]; | |
// WORKAROUND http://openradar.appspot.com/radar?id=1110403 | |
[dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"US"]]; | |
// translate to Gregorian calendar if other calendar is selected |
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 time | |
from scxml.pyscxml import StateMachine | |
import logging | |
logging.basicConfig(level=logging.NOTSET) # show detailed debug info | |
xml = ''' | |
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"> | |
<state id="main"> | |
<onentry> |
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 time | |
from scxml.pyscxml import StateMachine | |
import logging | |
logging.basicConfig(level=logging.NOTSET) # show detailed debug info | |
xml = ''' | |
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" datamodel="python" initial="S1"> | |
<state id="S1"> | |
<onentry> |
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
#!/usr/bin/env bash | |
# Generates gource video (h.264) out of multiple repositories. | |
# Pass the repositories in command line arguments. | |
# Example: | |
# <this.sh> /path/to/repo1 /path/to/repo2 | |
i=0 | |
for repo in $*; do | |
# 1. Generate a Gource custom log files for each repo. This can be facilitated by the --output-custom-log FILE option of Gource as of 0.29: | |
logfile="$(mktemp /tmp/gource.XXXXXX)" |
NewerOlder