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 | |
<% for type in types.classes { -%> | |
<%_ if type.attributes["final"] != nil || type.attributes["open"] != nil || types.based[type.name]?.isEmpty == false { continue } -%> | |
<%_ _%>git grep -lz 'class <%= type.name %>' | xargs -0 perl -i'' -pE "s/class <%= type.name %>(?=\s|:)/final class <%= type.name %>/g" | |
<% } %> |
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
button.onTouchUpInside(context: self) { context in | |
// doStuff | |
} |
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
// swiftlint:disable file_length | |
fileprivate func compareOptionals<T>(lhs: T?, rhs: T?, compare: (_ lhs: T, _ rhs: T) -> Bool) -> Bool { | |
switch (lhs, rhs) { | |
case let (lValue?, rValue?): | |
return compare(lValue, rValue) | |
case (nil, nil): | |
return true | |
default: | |
return false |
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 | |
import XCPlayground | |
XCPlaygroundPage.currentPage.needsIndefiniteExecution = true | |
func perform(initial: Int) { | |
var value: Int = initial | |
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1), dispatch_get_main_queue()) { [myConstant = value] in | |
print("constant in first block \(myConstant)") | |
print("captured \(value)") | |
value = initial * 2 |
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
require 'mechanize' | |
require 'moving_average' | |
mechanize = Mechanize.new | |
login_page = mechanize.get 'https://www.myfitnesspal.com/account/login' | |
form = login_page.forms.first | |
# noinspection RubyResolve | |
form.field_with(id: 'username').value = "username" | |
form.field_with(id: 'password').value = "pass" | |
form.submit |
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
IDEBundleInjection.c: Error 3587 loading bundle '/Users/merowing/Library/Developer/Xcode/DerivedData/GeekFitness-gtvztnsddwdauobsjnmkmeurgqks/Build/Products/Debug-iphonesimulator/GeekFitnessTests.xctest': The bundle “GeekFitnessTests” couldn’t be loaded because it is damaged or missing necessary resources. | |
DevToolsBundleInjection environment: | |
XCInjectDiagnostics: (null) | |
XCInjectBundleInto: /Users/merowing/Library/Developer/Xcode/DerivedData/GeekFitness-gtvztnsddwdauobsjnmkmeurgqks/Build/Products/Debug-iphonesimulator/GeekFitness.app/GeekFitness | |
XCInjectBundle: /Users/merowing/Library/Developer/Xcode/DerivedData/GeekFitness-gtvztnsddwdauobsjnmkmeurgqks/Build/Products/Debug-iphonesimulator/GeekFitnessTests.xctest | |
TestBundleLocation: /Users/merowing/Library/Developer/Xcode/DerivedData/GeekFitness-gtvztnsddwdauobsjnmkmeurgqks/Build/Products/Debug-iphonesimulator/GeekFitnessTests.xctest | |
TMPDIR: /Users/merowing/Library/Developer/CoreSimulator/Devices/39DF8175-6F30-4946-9B23-8B27018F1CE4/data/Containers/Data/Applica |
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
when_modified((@[self.counterLabel, self.textView]), ^(id weakSelf) { | |
[weakSelf updateCharacterLimit]; | |
}); |
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
@implementation KZPropertyMapper (MyAppBoxing) | |
+ (NSDate *)boxValueAsDateSince1970:(id)value __used | |
{ | |
if (value == nil) { | |
return nil; | |
} | |
AssertTrueOrReturnNil([value isKindOfClass:NSNumber.class]); | |
return [NSDate dateWithTimeIntervalSince1970:[value floatValue]]; | |
} |
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
//! raw builder | |
TMTween(self.view).animate(@"frame.origin.x", ^(TMTween *tween) { | |
tween.from = tween.view.left; | |
tween.to = 110; | |
tween.duration = 1.5; | |
tween.options = PMTweenOptionNone; | |
tween.easing = easing; | |
}).animate(@"backgroundColor.blue", ^(TMTween *tween) { | |
tween.from = 0.3f; | |
tween.to = 1.0; |