Skip to content

Instantly share code, notes, and snippets.

View MACastro987's full-sized avatar

Michael Castro MACastro987

View GitHub Profile
@MACastro987
MACastro987 / gist:4bbe7d5aa2dfb815ec7a
Last active August 29, 2015 14:27
View Controller
#import "ViewController.h"
@interface ViewController () <CLLocationManagerDelegate>
@end
@implementation ViewController{
NSString *currentLongitude;
NSString *currentLatitude;
NSString *googleMapsURL;
@MACastro987
MACastro987 / gist:303870cb4b137938cea9
Created August 13, 2015 19:00
Handle AlertViewController actions
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
NSString *alertTitle = nil;
NSString *alertMessage = nil;
NSString *alertOkButtonText = @"Ok";
switch (result) {
case MFMailComposeResultSent:{
alertTitle = @"Message Sent";
alertMessage = @"Your message has been sent";
break;
@MACastro987
MACastro987 / gist:f62043396641b16082c0
Last active February 23, 2016 23:41
TableViewCell AVPlayer
- (void)awakeFromNib {
self.playButton.layer.hidden = YES;
_playButtonTapped = NO;
}
- (void)setFeedItem:(PFObject *)feedItem {
_feedItem = feedItem;
PFUser *user = [feedItem objectForKey:@"user"];
[_usernameButton setTitle:user.username
forState:UIControlStateNormal];
- (void)viewWillLayoutSubviews
{
//scrollView.frame
statusIndicator.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
//Main Form
float fTop = 0.0; float fLeftIndent = 20.0;
float fFieldHeight = 60.0; float fCheckboxX = 275.0;
float fCheckboxSide = 35.0; float fLeftIndentRightColumn = 125.0;
@MACastro987
MACastro987 / gist:8fd95de946db4458ac8f9ff4eda99058
Created February 9, 2017 23:23
Http Request to Weather Underground
const string url = @"http://api.wunderground.com/api/72002fc4632c2927/conditions/q/27519.json";
async static void RetrieveData()
{
try
{
string contents;
string Url = String.Format(url);
HttpClient client = new HttpClient();
contents = await client.GetStringAsync(url);
@MACastro987
MACastro987 / gist:d097d366e1fb1ba6c40950d85cccd9ad
Created February 13, 2017 17:49
WeatherUnderground JSON Model
// Generated by json2csharp.com/#
public class Features
{
public int conditions { get; set; }
}
public class Response
{
public string version { get; set; }
public async Task<byte[]> Download()
{
var httpClient = new HttpClient();
var randomUri = UriManager.LoadRandomUri();
Task<byte[]> contentsTask = httpClient.GetByteArrayAsync(randomUri);
return await contentsTask;
}