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
#include <netinet/in.h> | |
#include <sys/socket.h> | |
#include <unistd.h> | |
#include <arpa/inet.h> | |
- (void)broadCast | |
{ | |
int socketSD = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); | |
if (socketSD <= 0) { | |
NSLog(@"Error: Could not open socket."); |
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
// adjust the label height (top align text) | |
// old | |
CGSize labelSize = [model.name sizeWithFont:self.nameLabel.font | |
constrainedToSize:_maxNameLabelSize | |
lineBreakMode:self.nameLabel.lineBreakMode]; | |
// new | |
CGSize labelSize = [model.name boundingRectWithSize:_maxNameLabelSize | |
options:NSStringDrawingUsesLineFragmentOrigin | |
attributes:@{NSFontAttributeName: self.nameLabel.font} | |
context:nil].size; |
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
# encoding: utf-8 | |
def company_serial_no_checker(serial) | |
# 共八位,全部為數字型態 | |
at_least_8_digits = /^\d{8}$/ | |
return false unless at_least_8_digits.match(serial) | |
# 各數字分別乘以 1,2,1,2,1,2,4,1 | |
# 例:統一編號為 53212539 |
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
// | |
// UIDeviceHardware.h | |
// | |
// Used to determine EXACT version of device software is running on. | |
#import <Foundation/Foundation.h> | |
@interface UIDeviceHardware : NSObject | |
- (NSString *) platform; |