This file contains hidden or 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
| CABasicAnimation *color = [CABasicAnimation animationWithKeyPath:@"borderColor"]; | |
| color.fromValue = (id)[UIColor clearColor].CGColor; | |
| color.toValue = (id)[UIColor redColor].CGColor; | |
| CABasicAnimation *width = [CABasicAnimation animationWithKeyPath:@"borderWidth"]; | |
| width.fromValue = @0; | |
| width.toValue = @1.5; | |
| CAAnimationGroup *both = [CAAnimationGroup animation]; | |
| both.duration = 0.5; | |
| both.animations = @[color, width]; | |
| both.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; |
This file contains hidden or 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
| # Select Xcode | |
| sudo xcode-select --switch /Applications/Xcode.app/ | |
| # run app with lldb | |
| xcrun lldb ...path to application.../Contents/MacOS/binaryname | |
| (lldb) run | |
| # pause app | |
| ctrl+c |
This file contains hidden or 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
| hash2id={"replace1":"with1","replace2":"with2"} | |
| xml_files=`find "/path/to/folder" -type f -name '*.xml'`.strip.split("\n") | |
| xml_files.each do |xml_file| | |
| puts "Processing #{xml_file}" | |
| original_text=File.read(xml_file) | |
| text=original_text.dup | |
| hash2id.each do |hash,id| | |
| text.gsub!(hash.to_s, id) |
This file contains hidden or 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)test_stepByStep_withCapacity | |
| { | |
| NSMutableArray *keys = [NSMutableArray new]; | |
| NSMutableArray *values = [NSMutableArray new]; | |
| srand(0x21112005); | |
| int entryCount = 1000000; | |
| for (int ix = 0, ixMax = entryCount; ix < ixMax ; ix++) { | |
| NSString *key = [NSString stringWithFormat:@"Key#%d", (ix + 1)]; | |
| NSString *value = [NSString stringWithFormat:@"Value with %d", rand()]; | |
| [keys addObject:key]; |
This file contains hidden or 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
| class MyClass {} | |
| let anObject = MyClass() | |
| print("The address of anObject is \(ObjectIdentifier(anObject))") |
This file contains hidden or 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
| var simulateScrollingTimer: Timer? | |
| var scrollUp = false | |
| private func simulateScrolling() { | |
| collectionView.contentOffset = CGPoint.zero | |
| scrollUp = false | |
| simulateScrollingTimer = Timer.scheduledTimer(timeInterval: 0.5, target: self, selector: #selector(simulateSwipe), userInfo: nil, repeats: true) | |
| } | |
| private func simulateSwipe() { | |
| guard collectionView.contentSize.height > 0 |
This file contains hidden or 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
| # brew install cloc | |
| cloc --csv --csv-delimiter=";" --report-file=~/Desktop/output.csv . |
This file contains hidden or 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
| expr -l Swift -- import UIKit | |
| expr -l Swift -- let $webview = unsafeBitCast(0x7b500026ca00, to: UIWebView.self) | |
| expr -l Swift -- print($webview.request.url) |
This file contains hidden or 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 ruby | |
| # This will compile the given Swift script and run it | |
| unless ARGV.count == 1 | |
| puts "Please provide the path for the Swift source file to compile and run" | |
| exit -1 | |
| end | |
| SOURCE_FILE = ARGV[0] | |
| BASE_NAME = File.basename(SOURCE_FILE, ".swift") |
This file contains hidden or 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
| #pragma mark - Simple Unit Test | |
| - (void)test_callSomeoneWith_giveSomething_getSomething { | |
| MyClass *sut = [MyClass new]; | |
| NSString *input = @„give something“; | |
| NSString *expectedResult = @„get something“; | |
| NSString *result = [sut callSomeoneWith:input]; | |
| XCTAssertEqualObjects(result, expectedResult); | |
| } |