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
public static class MyComparator implements Comparator<MyClass> { | |
@Override | |
public int compare(MyClass obj1, MyClass obj2) { | |
int value1 = obj1.getValue(); | |
int value2 = obj2.getValue(); | |
// Dumb way | |
if (value1 == value2) { | |
return 0; | |
} else if (value1 > value2) { |
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
// | |
// objsushi.h | |
// Objective-🍣 | |
// | |
// Created by akisute on 2014/04/01. | |
// Copyright (c) 2014年 akisute. All rights reserved. | |
// | |
#ifndef objsushi | |
#define objsushi |
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
# CocoaPods could completely break up your MyProject.xcodeproj to the state where even CocoaPods itself can't fix it, | |
# (for example, losing PODS_ROOT configulations) | |
# if you specify some broken Podfile. Adding `target "xxx" do ~ end` structure to your Podfile might be a trigger of this. | |
# So here's a tip: DO NOT ADD `target` unless absolutely nessessary. | |
#-------------------------------------------------------------------------------- | |
# WORKED | |
platform :ios, "7.0" | |
target "MyProject" do |
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
// OK | |
//UIImage *image = [UIImage imageNamed:@"bg"]; | |
//UIImage *image = [[UIImage imageNamed:@"bg"] stretchableImageWithLeftCapWidth:0 topCapHeight:11]; | |
//UIImage *image = [[UIImage imageNamed:@"bg"] stretchableImageWithLeftCapWidth:11 topCapHeight:11]; | |
//UIImage *image = [[UIImage imageNamed:@"bg"] resizableImageWithCapInsets:UIEdgeInsetsMake(11.0f, 0, 11.0f, 0)]; | |
//UIImage *image = [[UIImage imageNamed:@"bg"] resizableImageWithCapInsets:UIEdgeInsetsMake(11.0f, 11.0f, 11.0f, 0)]; | |
UIImage *image = [[UIImage imageNamed:@"bg"] resizableImageWithCapInsets:UIEdgeInsetsMake(11.0f, 0, 11.0f, 11.0f)]; | |
// NG | |
//UIImage *image = [[UIImage imageNamed:@"bg"] resizableImageWithCapInsets:UIEdgeInsetsMake(11.0f, 11.0f, 0, 0)]; | |
//UIImage *image = [[UIImage imageNamed:@"bg"] resizableImageWithCapInsets:UIEdgeInsetsMake(11.0f, 11.0f, 11.0f, 11.0f)]; |
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
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"MY-SUPERDUPER-ID"]; | |
[[GAI sharedInstance] ASM_setDefaultTracker:tracker]; | |
[[GAI sharedInstance] ASM_startAutomaticSessionManagement]; | |
// do usual stuff... | |
} |
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
Process: starbound [516] | |
Path: /Users/USER/Library/Application Support/Steam/*/Starbound.app/Contents/MacOS/starbound | |
Identifier: com.chucklefish | |
Version: 0 | |
Code Type: X86-64 (Native) | |
Parent Process: launchd [261] | |
Responsible: starbound [516] | |
User ID: 501 | |
Date/Time: 2014-01-26 23:18:09.140 +0900 |
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
#!/usr/bin/env ruby | |
# http://www.w3.org/TR/MathML2/script.html | |
table = { | |
A: 0x1D49C, | |
B: 0x0212C, | |
C: 0x1D49E, | |
# TODO: Add more characters here | |
a: 0x1D4B6, | |
e: 0x0212F, |
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
>>> "{:c}".format(0x1D4B6) | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
OverflowError: %c arg not in range(0x10000) (narrow Python build) |
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)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
self.textField.delegate = [AKTextFieldDelegateObject delegateObjectWithTraits:@[ | |
[AKTextFieldDelegateTrait minLength:4], | |
[AKTextFieldDelegateTrait minLength:16], | |
[AKTextFieldDelegateTrait format:@"^[a-zA-Z0-9_]+$"] | |
]]; | |
} |
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
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string | |
{ | |
NSUInteger length = textField.text.length + (string.length-range.length); | |
if ([textField isEqual:self.emailTextField] && length > 255) { | |
NSString *buffer = [textField.text stringByReplacingCharactersInRange:range withString:string]; | |
textField.text = [buffer substringToIndex:255]; | |
return NO; | |
} else if ([textField isEqual:self.passwordTextField] && length > 127) { | |
NSString *buffer = [textField.text stringByReplacingCharactersInRange:range withString:string]; | |
textField.text = [buffer substringToIndex:127]; |