This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Canvas = require('canvas') | |
| , Image = Canvas.Image | |
| , canvas = new Canvas(200, 200) | |
| , ctx = canvas.getContext('2d'); | |
| ctx.font = '30px Impact'; | |
| ctx.rotate(.1); | |
| ctx.fillText("Awesome!", 50, 100); | |
| var te = ctx.measureText('Awesome!'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var myAlertView = UIAlertView() | |
| myAlertView.title = "Test" | |
| myAlertView.message = "Hello, world!" | |
| myAlertView.addButtonWithTitle("Dismiss") | |
| myAlertView.show() |
NewerOlder