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
| MPRemoteCommandCenter.shared().nextTrackCommand.addTarget { (event) -> MPRemoteCommandHandlerStatus in | |
| print("next song") | |
| return .success | |
| } | |
| MPRemoteCommandCenter.shared().pauseCommand.addTarget { (event) -> MPRemoteCommandHandlerStatus in | |
| print("pause") | |
| return .success | |
| } |
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
| // Authorize the usage | |
| CMHeadphoneMotionManager.authorizationStatus() | |
| //Initialize the manager and set the delegate | |
| let motionManager = CMHeadphoneMotionManager() | |
| motionManager.delegate = self | |
| //Start tracking (simplified) | |
| //Implement the device motion handler callback to receive motion data | |
| if !motionManager.isDeviceMotionActive { |
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
| jspb.BinaryWriter.prototype.writeString=function(a,b){ | |
| if(null!=b){ | |
| this.rawWriteFieldHeader_(a,jspb.BinaryConstants.WireType.DELIMITED); | |
| for(var c=[],d=0; d < b.length; d++) { | |
| var e = b.codePointAt(d); | |
| if (e < 128) { |
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
| jspb.BinaryWriter.prototype.writeString=function(a,b){ | |
| if(null!=b){ | |
| this.rawWriteFieldHeader_(a,jspb.BinaryConstants.WireType.DELIMITED); | |
| for(var c=[],d=0; d < b.length; d++) { | |
| var e = b.charCodeAt(d); | |
| if (e < 128) { |
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
| // Emoji fix | |
| // Replace the function in protobuf/js/binary/encoder.js (at the bottom) | |
| jspb.BinaryEncoder.prototype.writeString = function(value) { | |
| var oldLength = this.buffer_.length; | |
| // UTF16 to UTF8 conversion loop swiped from goog.crypt.stringToUtf8ByteArray. | |
| for (var i = 0; i < value.length; i++) { | |
| var c = value.charCodeAt(i); | |
| if (c < 128) { |
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
| toDigits :: Integer -> [Integer] | |
| toDigits 0 = [] | |
| toDigits a = (toDigits c) ++ [b] where (c,b) = divMod a 10 | |
| toDigitsRev = reverse . toDigits | |
| doubleEveryOther :: [Integer] -> [Integer] | |
| doubleEveryOther (x:y:xs) = x*2 : y : (doubleEveryOther xs) | |
| doubleEveryOther a = a |
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
| The best skate videos right in your pocket. | |
| VIDEO HIGHLIGHTS | |
| Long press on a video to view highlights. This is super cool. | |
| BANGERS | |
| Double tap a video to mark it as BANGER. Watch it anytime on a BANGER list. | |
| All your favourite skate videos in one list, just one tap away. Ready to watch before skateboarding. |
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
| //In your ViewController define a property with SuggestionsList instance | |
| //in .h | |
| @property(retain)SuggestionsList *suggList; | |
| //in .m | |
| @synthesize suggList = _suggList; | |
| //initialize it with array of strings that contains suggestions you want to present | |
| NSArray *array = [NSArray arrayWithObjects:@"Berlin",@"Warsaw",@"Wroclaw",@"Barcelona",nil]; | |
| self.suggList = [[[SuggestionsList alloc] initWithArray:array] autorelease]; | |
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
| CGFloat BNRTimeBlock (void (^block)(void)); |
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
| //I've made sugMenu instance variable and initialized it. | |
| sugMenu = [[SuggestionMenu alloc] initWithSortedArray:array]; | |
| //make sure you are implementing UITextFieldDelegate protocol | |
| -(void)textFieldDidBeginEditing:(UITextField *)textField{ | |
| [sugMenu suggestForText:@"" inField:textField]; | |
| } | |
| //easy as that... | |
| - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{ |
NewerOlder