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
The following are tv commercials in the style of a highly emotional lifestyle branding campaign from Nike. They are inspirational and upbeat. Feel something. Dream bigger. The script contains 11 short lines. | |
Company: Nike | |
Product: Shoes | |
Short emotional tagline: Never too far down | |
Script: | |
We've all been underestimated and counted out | |
In those moments we felt like it was over | |
But it's when we're given no chance | |
that we somehow found that last bit of strength to keep fighting |
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
let task = Process() | |
var args = [String]() | |
args.append("-c") | |
let bundle = Bundle.main.bundlePath | |
args.append("sleep 0.2; open \"\(bundle)\"") | |
task.launchPath = "/bin/sh" | |
task.arguments = args | |
task.launch() | |
NSApplication.shared().terminate(nil) |
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
func usesAMPM() -> Bool { | |
let locale = NSLocale.currentLocale() | |
let dateFormat = NSDateFormatter.dateFormatFromTemplate("j", options: 0, locale: locale)! | |
if dateFormat.rangeOfString("a") != nil { | |
return true | |
} | |
else { | |
return false | |
} | |
} |
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
#!/bin/bash | |
###################################################################### | |
# | |
# | |
# Obb+ | |
# fkhairzad@ | |
# | |
# Usage: | |
# |
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
FILE_BASE=`echo "${TEMPFILE%.*}"` #file without extension | |
FILE_EXT="${TEMPFILE##*.}" #file extension |
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
static float rangeMap(float value, float low1, float low2, float high1, float high2){ | |
return low2 + (value - low1) * (high2 - low2) / (high1 - low1); | |
} |
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
func rangeMap(whereIs value:Double, low1:Double, low2:Double, high1:Double, high2:Double) -> Double { | |
return low2 + (value - low1) * (high2 - low2) / (high1 - low1) | |
} |
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
func getHSBA(color:UIColor) -> (hue:CGFloat, saturation:CGFloat, brightness:CGFloat, alpha:CGFloat) { | |
var hue:CGFloat = 0.0 | |
var sat:CGFloat = 0.0 | |
var bri:CGFloat = 0.0 | |
var alpha:CGFloat = 0.0 | |
color.getHue(&hue, saturation: &sat, brightness: &bri, alpha: &alpha) | |
return (hue:hue, saturation:sat, brightness:bri, alpha:alpha) | |
} |
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
let formatter = MKDistanceFormatter() | |
formatter.unitStyle = .Abbreviated | |
let distanceString = formatter.stringFromDistance(distance) |
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
import Contacts | |
// Convert to the newer CNPostalAddress | |
func postalAddressFromAddressDictionary(addressdictionary: Dictionary<NSObject,AnyObject>) -> CNMutablePostalAddress { | |
let address = CNMutablePostalAddress() | |
address.street = addressdictionary["Street"] as? String ?? "" | |
address.state = addressdictionary["State"] as? String ?? "" | |
address.city = addressdictionary["City"] as? String ?? "" |