Skip to content

Instantly share code, notes, and snippets.

View rosslebeau's full-sized avatar

Ross LeBeau rosslebeau

View GitHub Profile
import Foundation
public extension String {
public func replacing(range: CountableClosedRange<Int>, with replacementString: String) -> String {
let start = characters.index(characters.startIndex, offsetBy: range.lowerBound)
let end = characters.index(start, offsetBy: range.count)
return self.replacingCharacters(in: start ..< end, with: replacementString)
}
}
@loganwright
loganwright / swift-script
Last active May 15, 2016 05:15
A swift script to make dealing with new swift scripts a little easier :)
#!/usr/bin/env swift
#if os(OSX)
import Darwin
#else
import Glibc
#endif
import Foundation
@kostiakoval
kostiakoval / Valentine.swift
Created February 14, 2016 12:05
Valentine Day
import UIKit
import XCPlayground
let a = 10
let layer = CAShapeLayer()
layer.strokeColor = UIColor.redColor().CGColor
layer.fillColor = UIColor(red: 1, green: 0.33, blue: 0.33, alpha: 1).CGColor
layer.lineWidth = 12