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 ivimage | |
import ( | |
"fmt" | |
"testing" | |
"time" | |
) | |
func TestImage_Save(t *testing.T) { | |
// Please dont change value, you should change format |
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
# addSubview | |
UIView.transition(with: self.view, duration: 0.25, options: [.transitionCrossDissolve], animations: { | |
self.view.addSubview(view) | |
}, completion: nil) | |
# removeFromSuperview | |
UIView.transition(with: self.view, duration: 0.25, options: [.transitionCrossDissolve], animations: { | |
subview.removeFromSuperview() | |
}, completion: nil) |
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
// old | |
func getPreferredProductRefIdsFromContactProgress(contactProgress models.ContactProgress) []int { | |
if !contactProgress.IsEmpty() { | |
enterInfo := contactProgress.EnterInfo | |
enterInfoMap := make(map[string]interface{}) | |
json.Unmarshal([]byte(enterInfo), &enterInfoMap) | |
if enterInfoMap["product_ref_ids"] != nil { | |
value := reflect.ValueOf(enterInfoMap["product_ref_ids"]) | |
fmt.Println(value.Kind(), enterInfoMap["product_ref_ids"]) | |
var rawData string |
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 main | |
import ( | |
"errors" | |
"database/sql" | |
"encoding/json" | |
"fmt" | |
_ "github.com/go-sql-driver/mysql" | |
) |
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
I'm using MacOSX Siera 10.12 | |
sudo ln -s /usr/local/Cellar/pcre/8.40/include/pcre.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/pcre.h | |
If you do not install "pcre" , you can using brew | |
brew install pcre |
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 main | |
import ( | |
"fmt" | |
"reflect" | |
) | |
func main() { | |
checkType() | |
} |
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
validateName(name: String) { | |
if (name) { | |
if (/^[A-Za-z0-9][a-z0-9._\-]*$/.exec(name)) { | |
return true; | |
} | |
} | |
return false; | |
} | |
validateEmail(email: String) { |
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
#if Debug | |
#define DLog(...) NSLog(@"%@(%d),%@),__PRETTY_FUNCTION__,__LINE_,[NSString stringWithFormat:__VA_ARGS__]) | |
#elif Release | |
#define DLog(...) | |
#endif |
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
// find depth key in NSDictionary | |
- (id)findKey:(NSString *)keyname inObject:(id)object { | |
for (id subKey in object) { | |
id subObject = [object objectForKey:subKey]; | |
if ([subKey isEqualToString:keyname]) { | |
return subObject; | |
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
#define RGB(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1] | |
#define HEXCOLOR(c) [UIColor colorWithRed:((float)((c & 0xFF0000) >> 16))/255.0 green:((float)((c & 0xFF00) >> 8))/255.0 blue:((float)(c & 0xFF))/255.0 alpha:1.0] | |
#define UIColorFromRGB(rgbValue) \ | |
[UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ | |
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \ | |
blue:((float)(rgbValue & 0xFF))/255.0 \ | |
alpha:1.0] | |
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) | |
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) |
NewerOlder