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
"dependencies": { | |
"autoprefixer": "^6.4.1", | |
"babel": "^6.5.2", | |
"babel-core": "^6.14.0", | |
"babel-loader": "^6.2.5", | |
"babel-preset-es2015": "^6.14.0", | |
"babel-preset-react": "^6.11.1", | |
"css-loader": "^0.25.0", | |
"node-sass": "^3.9.3", | |
"postcss-loader": "^0.13.0", |
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
package main | |
import ( | |
"log" | |
"net/http" | |
"github.com/gorilla/websocket" | |
) | |
type Message struct { |
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
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Not enough memory" message:@"Guy! Look like your device doesn't have enough memory to run me! I'm gone now!" delegate:nil cancelButtonTitle:@"OK Bye!" otherButtonTitles:nil]; | |
[alert show]; | |
while ((!alert.hidden) && (alert.superview != nil)) | |
{ | |
[[NSRunLoop currentRunLoop] limitDateForMode:NSDefaultRunLoopMode]; | |
} |
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
lazy var persistentContainer: NSPersistentContainer = { | |
/* | |
The persistent container for the application. This implementation | |
creates and returns a container, having loaded the store for the | |
application to it. This property is optional since there are legitimate | |
error conditions that could cause the creation of the store to fail. | |
*/ | |
let container = NSPersistentContainer(name: “YOUR_CORE_DATA”) | |
container.loadPersistentStores(completionHandler: { (storeDescription, error) in | |
if let error = error as NSError? { |
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
let context = (UIApplication.shared.delegate as! AppDelegate).persistenContainer.viewContext |
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
lazy var applicationDocumentsDirectory: NSURL = { | |
let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) | |
return urls[urls.count-1] as NSURL | |
}() | |
lazy var managedObjectModel: NSManagedObjectModel = { | |
let modelURL = Bundle.main.url(forResource: "YOUR_CORE_DATA", withExtension: "momd")! | |
return NSManagedObjectModel(contentsOf: modelURL)! | |
}() |
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 saveContext() { | |
if managedObjectContext.hasChanges { | |
do { | |
try managedObjectContext.save() | |
} catch { | |
let nserror = error as NSError | |
fatalError("Unresolved error \(nserror), \(nserror.userInfo)") | |
} | |
} | |
} |
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
// iOS 10 only | |
let ferrari = Subaru(context: managedObjectContext) | |
ferrari.model = "Honda CRV" | |
// :( | |
let ferrari = NSEntityDescription.insertNewObject(forEntityName: "Subaru", into: managedObjectContext) as! Subaru | |
ferrari.model = "Honda CRV" |
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
PROJECT_NAME = ePPMobile | |
SCHEME_NAME = ePPMobile | |
BUILD_DIR = ./build | |
DEVICE_TYPE = iPad-Air-2, 10.0 | |
all: build run | |
build: clean | |
xcodebuild -arch i386 -sdk iphonesimulator10.0 -workspace $(PROJECT_NAME).xcworkspace -scheme $(SCHEME_NAME) -derivedDataPath $(BUILD_DIR) | |
clean: |
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
$ rustc binary_tree.rs -o binary_tree | |
error[E0072]: recursive type `Node` has infinite size | |
--> walkthrough_binary_tree.rs:1:1 | |
| | |
1 | struct Node { | |
| ^ recursive type has infinite size | |
| | |
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Node` representable |