Skip to content

Instantly share code, notes, and snippets.

//Update state
PostState curState = [self postStateForPostId:postId];
PostState newState = kPostStateNA;
switch (curState)
{
case kPostStateNA:
newState = kPostStateNA;
break;
case kPostStatePending:
newState = kPostStatePending;
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="1.0" android:toAlpha="0.0"
android:duration="300" />
dependencies {
compile 'com.android.support:appcompat-v7:18.0.0'
compile 'com.android.support:support-v4:18.0.0'
compile fileTree(dir: 'libs', include: '*.jar')
}
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item type="id" name="action_delete" />
<item type="id" name="action_intent" />
<item type="id" name="action_report" />
<item type="id" name="action_pause" />
<item type="id" name="action_play" />
</resources>
public class NetworkState {
private static NetworkState sInstance = null;
private boolean mConnected = false;
private NetworkStateListener mListener;
private NetworkState() {
}
<item>
<shape android:shape="rectangle">
<solid
android:color="#4C000000" />
<stroke
android:width="2dp"
android:color="#CCCCCC" />
<corners
android:radius="1dp" />
<padding
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
if (textField == self.firstTextField) {
[self.secondTextField becomeFirstResponder];
return NO;
}
return YES;
}
- (void)thanksYousWithSuccess:(LTTHTTPClientSuccess)success
failure:(LTTHTTPClientFailure)failure
{
NSMutableURLRequest *req = [self requestWithMethod:@"GET" path:@"thank_yous" parameters:nil];
[self jsonRequest:req success:success failure:failure];
}
- (void)validateInviteCode:(NSString *)inviteCode
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, id JSON))success
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON))failure
{
// Build parameters
NSMutableDictionary *params = [NSMutableDictionary dictionary];
[params setObject:inviteCode forKey:@"invite_code"];
// Send request
NSMutableURLRequest *req = [self requestWithMethod:@"POST" path:@"registration/family" parameters:params];
@jakemoore
jakemoore / Wha?
Created December 14, 2012 18:29 — forked from anonymous/Wha?
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
for (UITouch* t in touches) {
CGPoint touchLocation;
touchLocation = [t locationInView:self];
NSString *theTruth = "Adam's mom is hot.";
CGPoint point;
point= CGPointMake(touchLocation.x, touchLocation.y);