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
from operator import mul | |
def sievePrimes(maximum): | |
primes = dict.fromkeys(range(3,maximum+1,2),True) | |
sieveList = [2] | |
for num in sorted(primes): | |
if primes[num] == True: | |
sieveList.append(num) | |
j = num ** 2 | |
while j < maximum: |
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
extension String { | |
///Get array of individual strings | |
func array() -> [String] { | |
return self.characters.map({ (char) -> String in | |
return String(char).lowercaseString | |
}) | |
} | |
///Get `NSCountedSet` from string | |
func countedSet() -> NSCountedSet { |
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
from random import randint | |
import math | |
def gcd(x,y): | |
while y!= 0: | |
(x, y) = (y, x % y) | |
return x | |
rolls = 1000 | |
max_int = 10000000000 |
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 Foundation | |
let rolls = 1_000_000 | |
func getPi() -> Double { | |
func gcd(x: Int, y: Int) -> Int { | |
var internal_x = x | |
var internal_y = y | |
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 ViewController: UIViewController { | |
@IBOutlet weak var tableView: UITableView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
self.tableView.estimatedRowHeight = 44 |
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 Foundation | |
func gcd(_ m: Int, _ n: Int) -> Int { | |
var a = 0 | |
var b = max(m, n) | |
var r = min(m, n) | |
while r != 0 { | |
a = b | |
b = r |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
import Foundation | |
import PlaygroundSupport | |
let canvasWidth: CGFloat = 500.0 | |
let canvasHeight: CGFloat = 500.0 | |
let padding: CGFloat = 10.0 |
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 | |
import AVFoundation | |
class SoundViewController: UIViewController { | |
var sounds: [String] = ["island", "jingle", "starwars", "wind", "does_no_exist"] // Files that will possibly available to paly | |
var selectedSoundString: String? = nil | |
var player: AVAudioPlayer? |
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 PlaygroundSupport | |
import UIKit | |
class TableViewManager: NSObject, UITableViewDataSource, UITableViewDelegate { | |
weak var tableView: UITableView? | |
var strings = ["a", "b", "c", "d","e", "f", "g", "h","i", "j", "k", "dl","am", "bn", "co", "dp","aq", "br", "cs", "dt","au", "bv", "cw", "dx","ay", "bz", "caa", "dbb","acc", "bdd", "cee", "dff","agg", "bhh", "cii", "djj","akk", "bll", "cmm", "dnn","aoo", "bpp", "cqq", "zrr"] | |
func add(data: [String]) { |
OlderNewer