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 sieveOfErastosthene(max: Int) -> [Bool] { | |
// we assume every number is prime | |
var flags = Array(count: max + 1, repeatedValue: true) | |
flags[0] = false | |
flags[1] = false | |
let squareRoot = Int(sqrt(Double(max))) | |
for i in 2...squareRoot { | |
if flags[i] { |
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 = CoreDataManager.sharedInstance.managedObjectContext | |
let product = Product(context: context) | |
// modificas el producto como deseas | |
func viewWillDisappear(animated: Bool) { | |
super.viewWillDisappear(animated) | |
CoreDataManager.sharedInstance.managedObjectContext.rollback() | |
} |
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
// | |
// ManagedDocumentHandler.swift | |
// DominicanFuel | |
// | |
// Created by Julian Tejera on 3/31/15. | |
// Copyright (c) 2015 Julian Tejera. All rights reserved. | |
// | |
import UIKit |
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
- (void)scrollViewDidScroll:(UIScrollView *)scrollView | |
{ | |
if(scrollView.contentOffset.y | |
>= | |
(scrollView.contentSize.height - scrollView.frame.size.height)){ | |
NSLog(@"BOTTOM REACHED"); | |
} | |
if(scrollView.contentOffset.y <= 0.0){ | |
NSLog(@"TOP REACHED"); | |
} |
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
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { | |
NSLog(@"My token is: %@", deviceToken); | |
// Push Device Token to Server | |
} |
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
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Linq; | |
using System.Runtime.CompilerServices; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace DemoMVVM.Models | |
{ |
NewerOlder