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 / 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 / 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:14
LocalNotifications, data in LocalNotifications
notification.userInfo = [ "notificationId": myNotificationId ]
@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 / 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: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 / .htaccess
Last active December 4, 2015 22:11 — forked from thoop/.htaccess
Official prerender.io .htaccess for Apache.
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change http://example.com (at the end of the last RewriteRule) to your website url
<IfModule mod_headers.c>
#RequestHeader set X-Prerender-Token "YOUR_TOKEN"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
@adagio
adagio / getListingShop.json
Last active November 27, 2015 00:43
Etsy API getListingShop response
{
"count": "6",
"results": {
"0": {
"(Data about Shop)"
},
"1": {
"(Error messages)"
},
"2": {
@adagio
adagio / routes.rb
Created August 30, 2014 23:53
Include weeks in routes.rb
...
resources :weeks
...
@adagio
adagio / _week.html.erb
Created August 30, 2014 23:50
Partial for week properties
<tr>
<td><%= week.firstDay %></td>
<td><%= week.comment %></td>
<td><%= week.another_property %></td>
</tr>