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
//To generate base64 encrypted text: https://jsfiddle.net/gCHAG/3036/ | |
//Add #import <CommonCrypto/CommonCrypto.h> in *-Bridging-Header.h | |
extension String { | |
//TO DO: refactor later | |
func toHex() -> String { | |
var strToReturn = "" | |
var strIndex = self.startIndex | |
while strIndex < self.endIndex { | |
if let uScalar = UnicodeScalar(String(self[strIndex])) { |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
//sample board class | |
class Board{ | |
var noOfCols, noOfRows: Int | |
var items: [[Character]] | |
init(rows: Int, cols: Int, board: [[Character]]) { |
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
static void checkClassMethods(Class className); | |
void checkClassMethods(Class className){ | |
Method *methods; | |
unsigned int nMethods; | |
methods = class_copyMethodList(className, &nMethods); | |
Method curMethod; | |
while (nMethods--) { | |
curMethod = methods[nMethods]; | |
NSLog(@"method name %@", NSStringFromSelector(method_getName(curMethod))); | |
Dl_info info; |
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
//can remove 'if' checks and excess code if u knows that the underlining implementation can handle those situation well : | |
static inline void checkClassAndMethodIntegrity(Class classToTest, SEL methodToTest, const char *pathName, const char *nearestObjectSymbol) __attribute__((always_inline)); | |
void checkClassAndMethodIntegrity(Class classToTest, SEL methodToTest, const char *pathName, const char *nearestObjectSymbol) { | |
Dl_info info; | |
IMP imp = class_getMethodImplementation(classToTest, methodToTest); | |
if (imp && dladdr(imp, &info)) { | |
//printf("dli_fname: %s\n", info.dli_fname); | |
//printf("dli_sname: %s\n", info.dli_sname); | |
//printf("dli_fbase: %p\n", info.dli_fbase); |
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
+ (NSString *)getFormatForNumber:(CGFloat)floatNumber{ | |
NSString *floatNumberStr = [NSString stringWithFormat:@"%.7f", floatNumber]; | |
NSString *defaultFormat = @"#,##0.00"; | |
NSString *currentFormat = defaultFormat; | |
NSRange fromDecimalRange = [floatNumberStr rangeOfString:@"."]; | |
if (fromDecimalRange.location != NSNotFound) { | |
NSRange fromFormatRange =[floatNumberStr rangeOfString:@"[1-9]" options:NSRegularExpressionSearch]; | |
if (fromFormatRange.location != NSNotFound && fromFormatRange.location >= fromDecimalRange.location+2) { | |
NSMutableString *firstFormat = [NSMutableString stringWithString:defaultFormat]; |
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
// | |
// P2MSUserAgentHelper.m | |
// | |
// Created by PYAE PHYO MYINT SOE on 20/11/14. | |
// Copyright (c) 2015 P2MS. All rights reserved. | |
// | |
#import "P2MSUserAgentHelper.h"//add method declaration here | |
#import <sys/utsname.h> | |
#import <net/if.h> |
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
import android.content.Context; | |
import android.content.pm.PackageInfo; | |
import android.content.pm.PackageManager; | |
import android.os.Build; | |
/** | |
* Created by pyaephyoms on 27/1/15. | |
*/ | |
public class AndroidUserAgentHelper { | |
private static String userAgentString = null; |
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
package com.locale.library.localehelper; | |
import android.content.Context; | |
import android.content.res.Configuration; | |
import android.content.res.Resources; | |
import java.util.Locale; | |
/** | |
* Created by pyae phyo myint soe on 9/1/15. |