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
| // | |
| // Created by Danilo Priore on 18/08/12. | |
| // Copyright (c) 2012 Prioregroup.com. All rights reserved. | |
| // | |
| - (UIImage*)addTextToImage:(UIImage*)img text:(NSString*)text1 XPos:(int)xpos YPos:(int)ypos fontName:(NSString*)fontName fontSize:(CGFloat)fontSize fontColor:(UIColor*)fontColor { | |
| int w = img.size.width; | |
| int h = img.size.height; | |
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
| // 1. Before create a HTML file named mywidget.html and with content : | |
| // <html> | |
| // <head> | |
| // <title></title> | |
| // <script src="http://platform.twitter.com/widgets.js"> </script> | |
| // </head> | |
| // <body> | |
| // <a class="twitter-timeline" height="%i" href="https://mobile.twitter.com/DaniloPriore" data-widget id="318522515175645184" data-chrome="noheader nofooter transparent" data-border-color="#cc0000" style="display:none"> </a> | |
| // </body> | |
| //</html> |
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
| // create a static class | |
| public static class DataReaderExtension | |
| { | |
| public static IEnumerable<Dictionary<string, object>> AsEnumerable(this System.Data.IDataReader source) | |
| { | |
| if (source == null) | |
| throw new ArgumentNullException("source"); | |
| while (source.Read()) | |
| { |
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)setConstraintValue:(CGFloat)value forAttribute:(NSLayoutAttribute)attribute animation:(BOOL)animation | |
| { | |
| NSArray *constraints = self.view.constraints; | |
| NSPredicate *predicate = [NSPredicate predicateWithFormat:@"firstAttribute = %d", attribute]; | |
| NSArray *filteredArray = [constraints filteredArrayUsingPredicate:predicate]; | |
| NSLayoutConstraint *constraint = [filteredArray firstObject]; | |
| if (constraint.constant != value) { | |
| [self.view removeConstraint:constraint]; | |
| constraint.constant = value; | |
| [self.view addConstraint:constraint]; |
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
| #include <stdio.h> | |
| #include <netinet/in.h> | |
| #include <stdlib.h> | |
| #include <sys/sysctl.h> | |
| #include <net/if.h> | |
| #include <string.h> | |
| #include <net/route.h> | |
| #include <arpa/inet.h> | |
| #define CTL_NET 4 /* network, see socket.h */ |
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
| // | |
| // https://github.com/priore/SOAPEngine/blob/master/CSHARP/AES256Class.cs | |
| // | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Web; | |
| using System.Security.Cryptography; | |
| using System.IO; | |
| using System.Text; |
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
| // | |
| // https://github.com/priore/SOAPEngine/blob/master/CSHARP/3DESClass.cs | |
| // | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Web; | |
| using System.Security.Cryptography; | |
| using System.IO; | |
| using System.Text; |
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)validVideoURL:(NSString*)url valid:(void(^)())valid invalid:(void(^)())invalid | |
| { | |
| // AFNetworking https://github.com/AFNetworking | |
| AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; | |
| manager.responseSerializer = [AFHTTPResponseSerializer serializer]; | |
| manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/vnd.apple.mpegurl", @"video/mp2t", | |
| @"video/mov", @"video/mpv", @"video/3gp", @"video/mp4", nil]; | |
| NSMutableURLRequest *request = [manager.requestSerializer requestWithMethod:@"HEAD" URLString:url parameters:nil error:nil]; | |
| AFHTTPRequestOperation *operation = [manager HTTPRequestOperationWithRequest:request success:^(AFHTTPRequestOperation *operation, id responseObject) { | |
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
| @interface MYPlayer : AVPlayer | |
| { | |
| id playerObserver; | |
| } | |
| - (void)play; | |
| - (void)stop; | |
| - (void)pause; | |
| @end |
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
| // Detect the type of iPhone Device independent from iOS version | |
| CGSize size = [UIScreen mainScreen].bounds.size; | |
| CGFloat r = size.width > size.height ? size.width / size.height : size.height / size.width; | |
| if (r < 1.5) { | |
| // iPad | |
| } else if (r == 1.5) { | |
| // iPhone 4 | |
| } else if (r > 1.5) { | |
| // iPhone 5/6/6+ | |
| } |