Skip to content

Instantly share code, notes, and snippets.

View adagio's full-sized avatar
👨‍💻
practicing NestJS / learning about AI

Edu F adagio

👨‍💻
practicing NestJS / learning about AI
View GitHub Profile
@adagio
adagio / AppDelegate.swift
Created April 19, 2017 03:04
CoreData, migrations to App Group Container
lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator = {
// ..
let containerURL = fileManager.containerURLForSecurityApplicationGroupIdentifier("group.com.myapp.MyApp")
let groupURL = containerURL!.URLByAppendingPathComponent(databaseName)
// ..
}
@adagio
adagio / AppDelegate.swift
Last active April 19, 2017 03:06
CoreData, migrations to App Group Container
let store = try coordinator.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: groupURL, options: options)
@adagio
adagio / AppDelegate.swift
Created April 19, 2017 03:07
CoreData, migrations to App Group Container
try coordinator.migratePersistentStore(store, toURL: groupURL, options: options, withType:NSSQLiteStoreType)
@adagio
adagio / code1.swift
Created April 19, 2017 03:14
LocalNotifications, data in LocalNotifications
notification.userInfo = [ "notificationId": myNotificationId ]
@adagio
adagio / code2.swift
Created April 19, 2017 03:16
data in LocalNotifications
let userInfoCurrent = notification.userInfo! as! [String:AnyObject]
let uid = userInfoCurrent["notificationId"]! as! String
if uid == targetNotificationId {
// aplicamos alguna acción aquí
}
@adagio
adagio / code1.swift
Created April 19, 2017 03:27
ImageCaching for CellForRow
let id = thought.valueForKey("id") as! String
if let cachedImage = ImageCache.sharedCache.imageForKey("image-\(id)") {
cell.picture.image = cachedImage
} else {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), {
let scaledImage = Helper.scaleUIImageToSize(image!, size: size)
ImageCache.sharedCache.setImage(scaledImage, forKey: "image-\(id)")
dispatch_async(dispatch_get_main_queue(), {
@adagio
adagio / CharsToStrings.swift
Created June 14, 2017 01:24
Map for string characters
var str = "Hello, playground"
var strings = [String]()
str.characters.map{strings.append(String($0))}
@adagio
adagio / colors.dart
Created September 16, 2018 23:24
Colors (Flutter+Dart)
final _color1 = Colors.red;
final _color2 = Colors.blueGrey[900];
final _color3 = Colors.amberAccent;
final _color4 = Colors.pink.shade50;
//final _color5 = Colors.lightRed;
final _color6 = Colors.transparent;
final _color7 = const Color(0xFF013487);
final _color8 = const Color(0xFF4CD132);
//final _color9 = const Color(0xFF0134GG);
@adagio
adagio / flutter_udacity.md
Last active September 26, 2018 19:08
Flutter course in Udacity