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
| // Operators | |
| extension Publisher where Self.Output: Equatable { | |
| public func test(equalTo expectation: [Self.Output]) -> AnyCancellable { | |
| self | |
| .assertNoFailure() | |
| .reduce([Self.Output](), { $0 + [$1] }) | |
| .sink() { assert($0 == expectation) } | |
| } | |
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
| $('.transactionAmount').map(function(x,y) { return $(y).text().replace('€','').replace(',','.'); }).map((x,y) => parseFloat(y)).toArray().reduce(function(x,y) { return x + y}, 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
| find . -name \* | awk '{if(length($1)>100) { print length($1),$1 } }' | sort |
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
| #!/bin/bash | |
| # | |
| # Creates a directory named "magpi" on your home folder and all issues are downloaded there. | |
| # It also checks if you already have some of the issues and skips them from downloading. | |
| # Use argument: --log OFF to disable logging. It is there because I have this script on my crontab and I needed to monitor if it running properly. For enabling logging do: | |
| # $ sudo touch /var/log/magpi.log | |
| # $ sudo chmod 666 /var/log/magpi.log | |
| # That's it. | |
| # | |
| # Command execution is: |
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
| everyauth.linkedin | |
| .consumerKey(LINKEDIN_CONSUMER_KEY) | |
| .consumerSecret(LINKEDIN_CONSUMER_SECRET) | |
| .fetchOAuthUser(function (accessToken, accessTokenSecret, params) { // This method is override because we need to get extra info from user profile | |
| var promise = this.Promise(); | |
| this.oauth.get(this.apiHost() + '/people/~:(id,first-name,last-name,emailAddress,headline,location:(name,country:(code)),industry,num-connections,num-connections-capped,summary,specialties,proposal-comments,associations,honors,interests,positions,publications,patents,languages,skills,certifications,educations,three-current-positions,three-past-positions,num-recommenders,recommendations-received,phone-numbers,im-accounts,twitter-accounts,date-of-birth,main-address,member-url-resources,picture-url,site-standard-profile-request:(url),api-standard-profile-request:(url,headers),public-profile-url)', accessToken, accessTokenSecret, function (err, data, res) { | |
| if (err) { | |
| err.extra = {data: da |
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
| dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
| NSURL *mp3URL = [NSURL URLWithString:@"http://zhangmenshiting.baidu.com/data2/music/44799433/4479927746800128.mp3?xcode=dbff90a141d5d136fdc7275fdc3fae126077a44adc974ad8"]; | |
| NSData *data = [NSData dataWithContentsOfURL:mp3URL]; | |
| self.audioPlayer = [[AVAudioPlayer alloc] initWithData:data error:NULL]; | |
| [self.audioPlayer play]; | |
| }); |
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
| #define $(...) ((NSString *)[[NSArray arrayWithObjects:__VA_ARGS__, nil] componentsJoinedByString:@""]) | |
| /* | |
| * Example | |
| */ | |
| NSString *string = $(@"Hello", @" ", @"World!", @"\n", @"1 + 2 = ", @(1+2)); |
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
| .parent { | |
| position: relative; | |
| } | |
| .child { | |
| position: absolute; | |
| display: block; | |
| left: 0; | |
| right: 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
| <html> | |
| <head> | |
| <link type="text/css" href="http://jplayer.org/latest/skin/blue.monday/jplayer.blue.monday.css" rel="stylesheet" /> | |
| <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> | |
| <script type="text/javascript" src="http://jplayer.org/latest/js/jquery.jplayer.min.js"></script> |