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
typealias Closure = (Int) -> (Bool) | |
class MyFilterArrayView: SequenceType, GeneratorType { | |
var _array: [Int]? | |
var _lazyFilter: MyFilterArrayView? | |
var _closure: Closure | |
var _currentIndex: Int = 0 | |
var array: [Int] { | |
get { |
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
1.sumToArray([1,2,3]) | |
"a".sumToArray(["1","2","3"]) |
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 Queue | |
a = [1, [2], [3], [4,5]] | |
q = Queue.Queue() | |
res = [] | |
def copy_arr_to_q(arr, q): | |
for item in arr: |
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
# Xcode 6 | |
cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer | |
cd SDKs/iPhoneSimulator.sdk/usr/lib/ | |
sudo mv dyld_sim dyld_sim_orig | |
# Xcode beta | |
cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer | |
cd SDKs/iPhoneSimulator.sdk/usr/lib/ | |
sudo mv dyld_sim dyld_sim_orig |
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
96: FBProfileSetEventsCalendarSubscriptionStatusMutationOptimisticPayloadFactoryProtocol-Protocol.h | |
95: FBGroupUpdateRequestToJoinSubscriptionLevelMutationOptimisticPayloadFactoryProtocol-Protocol.h | |
94: FBEventUpdateNotificationSubscriptionLevelMutationOptimisticPayloadFactoryProtocol-Protocol.h | |
93: FBReactionUnitUserSettingsDisableUnitTypeMutationOptimisticPayloadFactoryProtocol-Protocol.h | |
93: FBMemReactionAcornSportsContentSettingsSetShouldNotPushNotificationsResponsePayloadBuilder.h | |
92: FBReactionUnitUserSettingsEnableUnitTypeMutationOptimisticPayloadFactoryProtocol-Protocol.h | |
91: FBProfileUpdateSecondarySubscribeStatusMutationOptimisticPayloadFactoryProtocol-Protocol.h | |
91: FBViewerNotificationsUpdateAllSeenStateMutationOptimisticPayloadFactoryProtocol-Protocol.h | |
90: FBMemReactionAcornSportsContentSettingsSetShouldPushNotificationsResponsePayloadBuilder.h | |
89: FBMemReactionAcornTvContentSettingsSetShouldNotPushNotificationsResponsePayloadBuilder.h |
This file has been truncated, but you can view the full file.
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
res = | |
with {:ok} <- validate_request(request), | |
{:ok, user} <- get_user(request), | |
{:ok} <- update_db(user), | |
{:ok} <- send_email(user) do | |
return_http_message | |
end | |
case res do | |
{:error, x} -> IO.inspect("Error: " <> x) |
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
let string = "This is the string" | |
let start = string.index(string.startIndex, offsetBy: 1) | |
let end = string.index(string.endIndex, offsetBy: -1) | |
string[start..<end] |
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 cleanRegex(pattern: String) -> String { | |
let res = pattern.characters.enumerate().reduce(([], [])) { (acc, enumerator) -> ([Int], [Int]) in | |
if enumerator.element == "{" { | |
return (acc.0 + [enumerator.index], acc.1) | |
} | |
if enumerator.element == "}" { |
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
// Impelentation Counter as a Function | |
typealias Mutators = () -> () | |
typealias Getter = () -> Int | |
typealias Setter = (Int) -> () | |
func Counter(number initial: Int) -> (getNumber: Getter, setNumber: Setter, increment: Mutators, decrement: Mutators) { | |
var v = initial | |
let getNumber = { return v } |
OlderNewer