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 appDelegate = UIApplication.sharedApplication().delegate as AppDelegate | |
var context = appDelegate.managedObjectContext | |
var request = NSFetchRequest(entityName: "Entity") | |
request.fetchLimit = 1 | |
request.sortDescriptors = [NSSortDescriptor(key: "id", ascending: false)] | |
var error: NSError? = nil | |
let entities = context.executeFetchRequest(request, error: &error) as [Entity] |
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
// in controller returned to | |
let backButton = UIBarButtonItem(title: "Home/Return or nohing", style: .Bordered, target: nil, action: nil) | |
navigationItem.backBarButtonItem = backButton |
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 UIKit | |
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { | |
@IBOutlet var tableView: UITableView! | |
var itemsInSections: Array<Array<String>> = [["1A", "1B", "1C"], ["2A", "2B"], ["3A", "3B", "3C", "3D", "3E"]] | |
var sections: Array<String> = ["Section 1", "Section 2", "Section 3"] | |
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
# OS X Finder | |
.DS_Store | |
# Xcode per-user config | |
*.mode1 | |
*.mode1v3 | |
*.mode2v3 | |
*.perspective | |
*.perspectivev3 | |
*.pbxuser |
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
git init | |
git add . | |
git commit -m 'initial commit' | |
git remote add origin [email protected]:user/repo.git | |
git push origin master |
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
ssh-keygen -t rsa -C "[email protected]" |
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
CREATE TABLE `date` ( | |
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, | |
`date` date NOT NULL, | |
`day` tinyint(2) unsigned NOT NULL, | |
`month` tinyint(2) unsigned NOT NULL, | |
`year` year(4) NOT NULL, | |
`day_of_week` tinyint(1) unsigned NOT NULL COMMENT '1 = monday, 7 = sunday', | |
`day_of_year` smallint(3) unsigned NOT NULL COMMENT 'starting from 0 to 365', | |
`week` tinyint(2) unsigned NOT NULL, | |
PRIMARY KEY (`id`) |
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
<?php | |
$countryList = array( | |
"AF" => "Afghanistan", | |
"AL" => "Albania", | |
"DZ" => "Algeria", | |
"AS" => "American Samoa", | |
"AD" => "Andorra", | |
"AO" => "Angola", | |
"AI" => "Anguilla", |
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
openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr |
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
# xcode-build-bump.sh | |
# @desc Auto-increment the build number every time the project is run. | |
# @usage | |
# 1. Select: your Target in Xcode | |
# 2. Select: Build Phases Tab | |
# 3. Select: Add Build Phase -> Add Run Script | |
# 4. Paste code below in to new "Run Script" section | |
# 5. Drag the "Run Script" below "Link Binaries With Libraries" | |
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0) |