This file contains hidden or 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 factorial_iterative(n): | |
if n < 0: | |
return None # Factorial is not defined for negative numbers | |
# Base cases: 0! and 1! are both 1 | |
elif n == 0 or n == 1: | |
return 1 | |
else: | |
# Initialize the result to 1 | |
result = 1 |
This file contains hidden or 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
(ns bbcode-obfuscator) | |
(defn opening-tag [tag-name] | |
(format "[%s]" tag-name)) | |
(defn closing-tag [tag-name] | |
(format "[/%s]" tag-name)) | |
(defn tag-info [tag-name] | |
{:name tag-name |
This file contains hidden or 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 | |
extension NSDateComponents { | |
subscript(unit: String) -> Int { | |
get { | |
switch unit{ | |
case "month": | |
return self.month | |
case "day": | |
return self.day |
This file contains hidden or 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
// | |
// SHSwipeEvent.h | |
// Sparrow | |
// | |
// Created by Shilo White on 3/10/11. | |
// Copyright 2011 Shilocity Productions. All rights reserved. | |
// | |
// This program is free software; you can redistribute it and/or modify | |
// it under the terms of the Simplified BSD License. | |
// |