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
(UIApplication.sharedApplication().delegate as AppDelegate).saveContext() |
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 applicationDidReceiveMemoryWarning(application: UIApplication) { | |
NSURLCache.sharedURLCache().removeAllCachedResponses() | |
} |
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
//Withing APP Delegate | |
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
// Override point for customization after application launch. | |
let cache = NSURLCache(memoryCapacity: 8 * 1024 * 1024, diskCapacity: 20 * 1024 * 1024, diskPath: nil) | |
NSURLCache.setSharedURLCache(cache) | |
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 alertController = UIAlertController(title: "Alert", message: "Your device does not support camera or photo libary", preferredStyle: UIAlertControllerStyle.Alert) | |
alertController.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil)) | |
self.presentViewController(alertController, animated: true, completion: 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
@IBAction func snapBarButtonItemTapped(sender: UIBarButtonItem) { | |
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera){ | |
var cameraController = UIImagePickerController() | |
cameraController.delegate = self | |
cameraController.sourceType = UIImagePickerControllerSourceType.Camera | |
let mediaTypes:[AnyObject] = [kUTTypeImage] | |
cameraController.mediaTypes = mediaTypes | |
} |
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
@@IDENTITY - returns the last identity value generated for any table in the current session, across all scopes. You need to be careful here, since it's across scopes. You could get a value from a trigger, instead of your current statement. | |
SCOPE_IDENTITY - returns the last identity value generated for any table in the current session and the current scope. Generally what you want to use. | |
IDENT_CURRENT - returns the last identity value generated for a specific table in any session and any scope. This lets you specify which table you want the value from, in case the two above aren't quite what you need (very rare). Also, as @Guy Starbuck mentioned, "You could use this if you want to get the current IDENTITY value for a table that you have not inserted a record into." | |
The OUTPUT clause of the INSERT statement will let you access every row that was inserted via that statement. Since it's scoped to the specific statement, it's more straightforward than the other functions above. However, it's a litt |
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
@Html.DropDownListFor(x=>x.ListName, | |
Model.ListName.Select(i => new SelectListItem | |
{ | |
Value = i.Id.ToString(), | |
Text = i.Title | |
}), | |
new { @class = "input-full" }) |
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
navigator.sayswho = (function () { | |
var ua = navigator.userAgent, tem, | |
M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*([\d\.]+)/i) || []; | |
if (/trident/i.test(M[1])) { | |
tem = /\brv[ :]+(\d+(\.\d+)?)/g.exec(ua) || []; | |
return 'IE ' + (tem[1] || ''); | |
} | |
M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?']; | |
if ((tem = ua.match(/version\/([\.\d]+)/i)) != null) M[2] = tem[1]; | |
return M.join(' '); |
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
<input type="text" title="email" required pattern="[^@]+@[^@]+\.[a-zA-Z]{2,6}" /> |
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
// This does not work and gives the wrong figure due to concatination | |
var shiftPrem = $('#Contract_Reward_ShiftPremium').val(); | |
var basePay = $('#Contract_Reward_BasePay').val(); | |
var total = basePay + (basePay * (shiftPrem/100)); | |
//This works by forcing javascript to treat the variables as numbers | |
shiftPrem = $('#Contract_Reward_ShiftPremium').val(); | |
basePay = $('#Contract_Reward_BasePay').val(); | |
total = +basePay + +(basePay * (shiftPrem/100)); |