Skip to content

Instantly share code, notes, and snippets.

function wordcount(paragraph) {
var totalSpaces = 0;
var letter;
for (var i = 0; i < paragraph.length; i++) {
letter = paragraph.substr(i, 1);
if (letter === ' ') {
totalSpaces = totalSpaces + 1;
}
}
ellipse(200, 50, 100, 100);
ellipse(200, 200, 200, 200);
line(10, 100, 100, 200);
//ellipse(200, 300, 50, 50);
ellipse(180, 40, 10, 10); //eye
ellipse(215, 40, 10, 10);
line(400, 100, 300, 200);
line(115, 250, 70, 400);
line(285, 250, 370, 400);
ellipse(200, 80, 40, 10);
@RameshRM
RameshRM / BackgroundFetch.swift
Last active March 8, 2022 14:36
Swift Background Fetch
Step 1: Enable capabilities "background fetch"
Step2 : Setup AppDelegate.swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let settings = UIUserNotificationSettings(forTypes: UIUserNotificationType.Alert, categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(settings)
UIApplication.sharedApplication().setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum)
return true;
@RameshRM
RameshRM / gist:310d97c6813908ff9b0e
Created October 16, 2014 04:14
Hello World Alert w/UIAlertView
var myAlertView = UIAlertView()
myAlertView.title = "Test"
myAlertView.message = "Hello, world!"
myAlertView.addButtonWithTitle("Dismiss")
myAlertView.show()