Skip to content

Instantly share code, notes, and snippets.

View mafellows's full-sized avatar

Michael Fellows mafellows

  • Austin, TX
View GitHub Profile
if ([PFUser currentUser]) {
PFInstallation *currentInstallation = [PFInstallation currentInstallation];
NSString *userId = currentInstallation[@"installationUser"];
if (![userId isEqualToString:[[PFUser currentUser] objectId]]) {
currentInstallation[@"installationUser"] = [[PFUser currentUser] objectId];
[currentInstallation saveEventually];
}
}
- (void)logInWithTwitter
{
[PFTwitterUtils logInWithBlock:^(PFUser *user, NSError *error) {
if (error) {
NSLog(@"Failed to login with Twitter..");
} else if (user.isNew) {
// Get information for new user
NSURL *verify = [NSURL URLWithString:@"https://api.twitter.com/1.1/account/verify_credentials.json"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:verify];
label.font = [UIFont fontWithName:@"GillSans-Bold" size:28.0f]; // GilSans-Bold size 28 font
label.shadowColor = [UIColor blackColor]; // Black shadow color
label.shadowOffset = CGSizeMake(2.0f, 2.0f); // Width and height of the shadow offset
label.layer.shadowRadius = 1.0f; // The blur radius (in points) used to render the layer’s shadow
label.layer.shadowOpacity = 1.0f; // The opacity of the layer’s shadow
// The %@ characters are placeholders for the string.
http://amdlasers.com/posttest/index.php?name=%@ %@ %@ %@&email=%@&address=%@&city=%@&state=%@&country=%@&zip=%@&phone=%@&fax=%@&date=%@&score=%f&ipad=%@&businessName=%@&serialNum=%@&licenseNum=%@
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
NSString *urlString = [url absoluteString];
if ([urlString rangeOfString:@"from-dealer"].location != NSNotFound) {
NSLog(@"This application was launched from the dealer app!");
return YES;
}
return NO;
}
@mafellows
mafellows / gist:10194214
Created April 8, 2014 21:19
Handling Geo Points with Parse
// To obtain the current location...
[PFGeoPoint geoPointForCurrentLocationInBackground:^(PFGeoPoint *geoPoint, NSError *error) {
if (error) {
// Unable to get user's location...
} else {
MKAnnotation *annotation = [[MKAnnotation alloc] init];
annotation.coordinate = CLLocationCoordinate2DMake(geoPoint.latitude, geoPoint.longitude);
annotation.title = @"My location!";
@mafellows
mafellows / gist:7425142
Last active December 28, 2015 02:08
Error running 'gem install mechanize'
Last login: Mon Nov 11 22:42:37 on ttys001
-bash: /etc/profile.d/rvm.sh: No such file or directory
Michaels-MacBook-Air-3:~ mafellow$ gem install mechanize
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
Michaels-MacBook-Air-3:~ mafellow$