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
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ | |
// © TheTradingParrot | |
//@version=5 | |
indicator("TTP Bull Market Support band", overlay = true) | |
sma = request.security(syminfo.tickerid, "1W", ta.sma(close, 20)) | |
ema = request.security(syminfo.tickerid, "1W", ta.ema(close, 21)) | |
s = plot(sma, "sma",color= color.red,linewidth=2 ) |
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
@interface MyWindow : UIWindow | |
@end | |
@implementation MyWindow | |
- (void)sendEvent:(UIEvent *)event { | |
[super sendEvent:event]; | |
NSSet *tocuhes = [event touchesForWindow:self]; |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
// arrays are implemented with structs which are value types therefore when assigned they get copied. | |
let a = [1,2,3,4,5] | |
var b = a | |
b.append(6) | |
print(a) |
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
struct IntStack { | |
var items = [Int]() | |
mutating func push(item: Int) { | |
items.append(item) | |
} | |
mutating func pop() -> Int { | |
return items.removeLast() | |
} | |
} |
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
// | |
// using basic protocols, compliaing to many and static | |
// | |
protocol TestProtocol { | |
var forcedSet: Int { get set } | |
var noNeedToSet: Int { get } | |
} | |
protocol TestTypeProtocol { |
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
func compareGreaterThan(a:Int, b:Int) -> Bool{ | |
return a > b | |
} | |
func compareLessThan(a:Int, b:Int) -> Bool{ | |
return a < b | |
} | |
func comparator(greaterThan:Bool) -> (Int, Int) -> Bool { | |
if greaterThan { |
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 Foundation | |
func telephones(input : String) { | |
var map = [String : String]() | |
let newlineChars = NSCharacterSet.newlineCharacterSet() | |
let spaceLineChars = NSCharacterSet.whitespaceCharacterSet() | |
let allLines = input.utf16.split { newlineChars.characterIsMember($0) }.flatMap(String.init) | |
guard allLines.count > 0 else{ |