This file contains 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
// note that we restricted age to accept numbers only | |
function addOne(age: number): number { | |
return age + 1; | |
} | |
console.log(addOne(32)); | |
//console.log(addOne("thirty two")); |
This file contains 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
import Cocoa | |
class ScreenshotViewController: NSViewController { | |
override func prepareForSegue(segue: NSStoryboardSegue, sender: AnyObject?) { | |
if let viewController = segue.destinationController as? PreviewViewController{ | |
viewController.image = getScreenshot() | |
} | |
} | |
func getScreenshot() -> NSImage { |
This file contains 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
func imageWithView(inView: UIView) -> UIImage? { | |
UIGraphicsBeginImageContextWithOptions(inView.bounds.size, inView.isOpaque, 0.0) | |
defer { UIGraphicsEndImageContext() } | |
if let context = UIGraphicsGetCurrentContext() { | |
inView.layer.render(in: context) | |
let image = UIGraphicsGetImageFromCurrentImageContext() | |
return image | |
} | |
return nil | |
} |
This file contains 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
<? | |
$entities = array('image', 'photo', 'text', 'source', 'site', 'traffic', 'money', 'book', 'e-book', 'file', 'smartphone', 'camera', 'notebook', 'cities', 'distances', 'cars', 'mobile', 'book', 'sex', 'love', 'classifieds', 'ads', 'alcohol', 'travel'); | |
$verbs = array('sell', 'buy', 'rent', 'exchange', 'free', 'give', 'book', 'clean', 'find', 'classify', 'compare'); | |
echo '<table style="width: 100%">'; | |
foreach ($entities as $entity) | |
{ | |
echo '<tr>'; | |
foreach ($verbs as $verb) | |
echo "<td style='font-size: 14px; padding: 5px; text-align: center'>$verb $entity</td>"; | |
echo '</tr>'; |
This file contains 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
Response: <NSHTTPURLResponse: 0x600000228a00> { URL: http://directapi.codehub.io/products/58d0a7c6826d4f21b890882a } { status code: 200, headers { | |
"Access-Control-Allow-Headers" = "Origin, X-Requested-With, Content-Type, Accept, Authorization, ApiKey, AppVersion"; | |
"Access-Control-Allow-Methods" = "GET,PUT,POST,DELETE,PATCH,OPTIONS"; | |
"Access-Control-Allow-Origin" = "*"; | |
Connection = "keep-alive"; | |
"Content-Length" = 3714; | |
"Content-Type" = "application/json; charset=utf-8"; | |
Date = "Tue, 21 Mar 2017 08:21:10 GMT"; | |
Etag = "W/\"e82-IGkUHdRs0eFHVrwELjz6VahSzG8\""; | |
Server = "nginx/1.4.6 (Ubuntu)"; |
This file contains 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
#!/bin/sh | |
# Just copy and paste the lines below (all at once, it won't work line by line!) | |
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY! | |
function abort { | |
echo "$1" | |
exit 1 | |
} | |
set -e |