Skip to content

Instantly share code, notes, and snippets.

View xgjames's full-sized avatar

James xgjames

  • Guangzhou, China
View GitHub Profile
@xgjames
xgjames / 0_reuse_code.js
Created March 10, 2016 09:54
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@xgjames
xgjames / NSPredicate_verify_Chinese_name.md
Last active August 16, 2016 10:34
NSPredicate 判断姓名是否为纯中文
    NSPredicate *nameRegex = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", @"^[\u4e00-\u9fa5]+$"];
    if (![nameRegex evaluateWithObject:name]) {
        NSLog(@"姓名栏有非中文字符");
        return;
    }
@xgjames
xgjames / keybase.md
Created August 24, 2015 06:36
keybase

Keybase proof

I hereby claim:

  • I am xgjames on github.
  • I am xgjames (https://keybase.io/xgjames) on keybase.
  • I have a public key whose fingerprint is ECE0 6A5E C6FA 4B0E ED24 E0EE 007F BEC8 D45A C09E

To claim this, I am signing this object:

@xgjames
xgjames / gist:7391bd7469289a413bf1
Last active August 29, 2015 14:25 — forked from tomohisa/gist:2897676
Add and Remove ChildViewController
// add child view
UIViewController* controller = [self.storyboard instantiateViewControllerWithIdentifier:@"test"];
[self addChildViewController:controller];
controller.view.frame = CGRectMake(0, 44, 320, 320);
[self.view addSubview:controller.view];
[controller didMoveToParentViewController:self];
// remove child view
UIViewController *vc = [self.childViewControllers lastObject];
[vc.view removeFromSuperview];