Skip to content

Instantly share code, notes, and snippets.

@PDMackinnon
PDMackinnon / anObject.JSON
Created September 10, 2019 10:16
Small JSON demo
{
"transparent": "allowing light to shine through",
"opaque": "hard to see through",
"unpredictable": "volatile",
"evolution": "gradual development over time",
"learn": "aquire new knowlege or skills",
"nest": "fit one object inside another",
"demo": {
"x": 25,
"y": 12.2,
@PDMackinnon
PDMackinnon / w3_02-ex01
Created June 16, 2014 16:02
Future Learn creative coding exercise - start/stop oscillating circles by mouse click
/*
* Creative Coding
* Week 3, 02 - array with sin()
* by Indae Hwang and Jon McCormack
* Copyright (c) 2014 Monash University
*
* This program demonstrates the use of arrays.
* It creates three arrays that store the y-position, speed and phase of some oscillating circles.
* You can change the number of circles by changing the value of num in setup()
* You can change the background colour by holding the left mouse button and dragging.
@PDMackinnon
PDMackinnon / showOrHideToolbar
Created February 3, 2014 15:50
example of show/hide a toolbar in response to a tap gesture
- (IBAction)tapOnce:(UITapGestureRecognizer *)sender {
if ([[self tools] isHidden]) {
[[self tools] setHidden:NO];
}
else {
[[self tools] setHidden:YES];
@PDMackinnon
PDMackinnon / performSegue
Created February 3, 2014 15:47
call perform segue - perhaps in response to a gesture
[self performSegueWithIdentifier:@"<#segueID#>" sender:sender];
@PDMackinnon
PDMackinnon / callJavascript
Created February 3, 2014 15:45
call Javascript from ObjectiveC - call to your UIWebView
NSString *jsreturn = [self.mainWebView stringByEvaluatingJavaScriptFromString:@"<#script#>"];
NSLog(@"jsreturn = %@",jsreturn);
@PDMackinnon
PDMackinnon / loadHTML
Created February 3, 2014 15:43
load local web page - in viewDidLoad
NSString *path = [[NSBundle mainBundle] pathForResource:@"<#index#>" ofType:@"<#html#>" inDirectory:@"<#www#>"];
NSURL *fileURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:fileURL];
NSLog(@"%@",fileURL);
[self.mainWebView loadRequest:request];
-(IBAction)returnToPrevious:(UIStoryboardSegue*)sender {
}
@PDMackinnon
PDMackinnon / background tableview image
Created February 2, 2014 20:09
This how to make a background image for the table view (iOS 7 & xcode)
// This how to make a background image for the table view
// you must also make the cell background colour clear in the story board
//in table view controller header file - and obtained by ctrl/right dragging imageview to the .h file
@property (strong, nonatomic) IBOutlet UIImageView *backImage;
//in table view controller implementation (.m) file and in viewDidLoad method: