Skip to content

Instantly share code, notes, and snippets.

await
retrieveUsers(
() -> defer users
)
await
retrieveUsers(
(users) -> defer users
)
#import <MobileCoreServices/MobileCoreServices.h>
#import <AssetsLibrary/AssetsLibrary.h>
#import "TTVideo.h"
#define BYTES_PER_PIXEL 4
@interface TTVideo ()
// Redeclared as readwrite so that we can write to the property and still be atomic with external readers.
@property (readwrite, nonatomic) Float64 videoFrameRate;
- (NSString *):(id)a {
return [self stringByAppendingString:[a description]];
}
- (NSString *):(id)a :(id)b { return [[self:a]:b];}
- (NSString *):(id)a :(id)b :(id)c
{ return [[[self:a]:b]:c]; }
-(NSArray*)objectForKeyedSubscript:(NSString*)pattern
{
NSError *error;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern options:0 error:&error];
NSAssert( ! error, @"regex processing error");
NSMutableArray *strings = [NSMutableArray new];
NSArray *matches = [regex matchesInString:self options:0 range:self.fullRange];
for(NSTextCheckingResult *match in matches) {
for (NSInteger i = 0; i < match.numberOfRanges; i++) {
6458a13 HEAD@{0}: rebase -i (finish): returning to refs/heads/master
6458a13 HEAD@{1}: rebase -i (start): checkout HEAD~3
d5a01b2 HEAD@{2}: rebase -i (finish): returning to refs/heads/master
d5a01b2 HEAD@{3}: rebase -i (start): checkout HEAD~2
d5a01b2 HEAD@{4}: commit: created os x project, moved everything from before to ruby folder
102eb7e HEAD@{5}: commit: created os x program
6458a13 HEAD@{6}: commit: debugging image export
ea72280 HEAD@{7}: commit: starting with code generation
be49753 HEAD@{8}: commit: working on javascript stuff, very slow
a687e4b HEAD@{9}: commit: finished .dfont and .ttc, as well as everything but UIView, UITableViewCell, and UICollectionViewCell
func generatorInclude<T, Y: Sequence where T: Equatable, T == Y.GeneratorType.Element>(seq: Y, element: T) -> Bool {
for e in seq {
if e == element {
return true
}
}
return false
}
extension Array {
require 'nokogiri'
if ARGV.size < 1
puts "please enter the file to use"
exit 1
end
storyboard = Nokogiri::XML(IO.read(ARGV[0]), &:noblanks).root
labels = storyboard.xpath("//label")
labels.each do |label|
require 'nokogiri'
require 'pry-byebug'
if ARGV.size < 1
puts "please enter the file to use"
exit 1
end
storyboard = Nokogiri::XML(IO.read(ARGV[0]), &:noblanks).root
views = storyboard.xpath("//subviews/*") + storyboard.xpath("//view")
func pollutionFromStartDate(startDate: NSDate, toEndDate:NSDate) -> Double {
if (readings.count == 0) {
return 0
}
let totalPollution = 0
if (startDate < readings.first()!.date) {
totalPollution += readings.first()!.pollutionLevel * (readings.first()!.date - startDate)
}