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
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// ... | |
[self fixWebView:self.webView recursiveView:self.webView loadingFinished:NO]; | |
} | |
- (void)fixWebView:(UIWebView *)webView recursiveView:(UIView *)view loadingFinished:(BOOL)finished |
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 "ValidationView.h" | |
#import "Validator.h" | |
@interface ValidationView () | |
@property (nonatomic, weak) IBOutlet UITextField *nameTextField; | |
@property (nonatomic, weak) IBOutlet UITextField *passwordTextField; | |
@property (nonatomic, weak) IBOutlet UIActivityIndicatorView *activityView; | |
@property (nonatomic, weak) IBOutlet UILabel *errorLabel; |
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
#[cfg(test)] | |
#[macro_use(expect)] | |
extern crate expectest; | |
#[cfg(not(test))] | |
fn main() { | |
println!("{}", mangle("This challenge doesn't seem so hard.")); | |
} |
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
#[cfg(test)] | |
#[macro_use(expect)] | |
extern crate expectest; | |
use std::fmt; | |
#[cfg(not(test))] | |
fn main() { | |
let data = r#" |
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
// This creates UIViewAnimationCurve with invalid rawValue. | |
// Should be exeption while unwrapping optional value. | |
let curve = UIViewAnimationCurve(rawValue: 9)! | |
// Prints "ease in out" (This is a first variant in the enum). | |
switch curve { | |
case .EaseInOut: | |
print("ease in out") | |
case .EaseIn: | |
print("ease in") |
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
fn main() { | |
let mut v = vec![4, 6, 7, 8, 5, 1, 2, 3, 15, 10, 35, 8, 2, 1, 201, 100]; | |
println!("before: {:?}", v); | |
sort_in_place(&mut v); | |
println!("after: {:?}", v); | |
} | |
fn sort_in_place(a: &mut [u32]) { | |
match a.len() { | |
0 | 1 => (), |
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
fn main() { | |
let person1 = Person::new("Ted".to_owned(), 14); | |
let name_lens = Person::name_lens(); | |
let person2 = (name_lens.set)(&person1, "Doe".to_owned()); | |
let person3 = (name_lens.set)(&person2, (name_lens.get)(&person1)); | |
let person3 = (Person::age_lens().set)(&person3, 22); | |
println!("person1 {:?}", person1); | |
println!("person2 {:?}", person2); |
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
echo "Waiting 5 seconds to prepare window. Press Ctrl-C to cancel." | |
sleep 5 | |
echo "Start" | |
for i in {1..30} | |
do | |
echo "Click: $i" | |
cliclick c:690,370 | |
cliclick c:505,525 |
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 <objc/runtime.h> | |
+ (void)swizzletouchesEndedForUIStatusBar | |
{ | |
if (IS_OS_7_OR_LATER && !IS_OS_8_OR_LATER) { | |
Method original, swizzled; | |
original = class_getInstanceMethod(NSClassFromString(@"UIStatusBar"), @selector(touchesEnded:withEvent:)); | |
swizzled = class_getInstanceMethod(self, @selector(swizzled_touchesEnded:withEvent:)); | |
method_exchangeImplementations(original, swizzled); |
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
fn main() { | |
let mut a = lazy(|| { | |
println!("Hello"); | |
546 + 233 | |
}); | |
println!("{:?}", a.value()); | |
println!("{:?}", a.value()); | |
println!("{:?}", a.value()); | |
} |
OlderNewer