Skip to content

Instantly share code, notes, and snippets.

View sohayb's full-sized avatar

Sohayb Hassoun sohayb

  • Rakuten Kobo Inc.
  • Ottawa, Canada
View GitHub Profile
@sohayb
sohayb / APIKit+Rx.swift
Last active February 18, 2017 06:54 — forked from chuganzy/APIKit+Rx.swift
RxSwift x APIKit (RxSwift 3.0 and Swift 3.0)
import Foundation
import APIKit
import RxSwift
extension Session {
func rx_sendRequest<T: Request>(request: T) -> Observable<T.Response> {
return Observable.create { observer in
let task = self.send(request) { result in
switch result {
case .success(let res):
@sohayb
sohayb / ArrayDeepCopy.swift
Last active October 13, 2023 07:58
Array deep copy in Swift
//Protocal that copyable class should conform
protocol Copying {
init(original: Self)
}
//Concrete class extension
extension Copying {
func copy() -> Self {
return Self.init(original: self)
}
@sohayb
sohayb / getAllRepos.sh
Created December 14, 2015 15:27
Clone all git repos from bitbucket. It can be modified easily to clone mercurial repos
#!/bin/bash
#Script to get all repositories under a user from bitbucket
#Usage: getAllRepos.sh [username] [password]
curl --user ${1}:${2} https://api.bitbucket.org/1.0/users/${1} > repoinfo
for repo_name in `grep \"name\" repoinfo | cut -f4 -d\"`
do
git clone https://${1}@bitbucket.org/${1}/$repo_name
done