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
function fedex12(p_tracking_number varchar2) return boolean is | |
trk varchar2(12); | |
tot number:=0; | |
mult number:=1; | |
chr varchar2(1); | |
begin | |
--if the data passed is 12 digits then strip everything but valid FedEx tracking number characters. | |
if length(p_tracking_number) = 12 then | |
for x in 1..length(p_tracking_number) loop | |
chr := upper(substr(p_tracking_number,x,1)); |
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
import UIKit | |
class Coordinator { } | |
class AppCoordinator { | |
fileprivate var isLoggedIn = false | |
fileprivate let navigationController:UINavigationController | |
fileprivate var childCoordinators = [Coordinator]() |
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
import UIKit | |
protocol AuthenticationCoordinatorDelegate:class { | |
func coordinatorDidAuthenticate(coordinator:AuthenticationCoordinator) | |
} | |
class AuthenticationCoordinator:Coordinator { | |
weak var delegate:AuthenticationCoordinatorDelegate? | |
let navigationController:UINavigationController |
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
import UIKit | |
protocol ProfileFlowCoordinatorDelegate:class { } | |
class ProfileFlowCoordinator:Coordinator { | |
fileprivate let navigationController:UINavigationController | |
fileprivate let profileViewController:ProfileViewController | |
fileprivate let navigationDelegate:NavigationControllerDelegate? |
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
def optimised_pagination(query, per_page, page): | |
'''A more efficient pagination for SQLAlchemy | |
Fetch one item before offset (to know if there's a previous page) | |
Fetch one item after limit (to know if there's a next page) | |
The trade-off is that the total items are not available, but if you don't need them | |
there's no need for an extra COUNT query | |
''' | |
offset_start = (page - 1) * per_page | |
query_offset = max(offset_start - 1, 0) |