Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Seyhun Akyürek seyhunak

🎯
Focusing
Block or report user

Report or block seyhunak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View DynamicValue.swift
import Foundation
typealias CompletionHandler = (() -> Void)
class DynamicValue<T> {
var value : T {
didSet {
self.notify()
}
}
@seyhunak
seyhunak / git-clearHistory
Created Aug 30, 2019 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
View git-clearHistory
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@seyhunak
seyhunak / web-servers.md
Created Dec 12, 2017 — forked from willurd/web-servers.md
Big list of http static server one-liners
View web-servers.md

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
View Refreshable.swift
@objc protocol Refreshable
{
/// The refresh control
var refreshControl: UIRefreshControl? { get set }
/// The table view
var tableView: UITableView! { get set }
/// the function to call when the user pulls down to refresh
@objc func handleRefresh(_ sender: Any);
View Conversation.swift
FIRDatabase.database().reference().child("conversations").child(location).observe(.value, with: { (snapshot) in
if(snapshot.childrenCount > 1) {
var removeCount = Int(snapshot.childrenCount) - 1
let enumerator = snapshot.children
while let rest = enumerator.nextObject() as? FIRDataSnapshot {
rest.ref.removeValue()
removeCount -= 1
if(removeCount == 0) {
@seyhunak
seyhunak / bubble_sort.swift
Created Oct 30, 2016
Bubble Sort Algoritm in Swift
View bubble_sort.swift
import Foundation
func bubbleSort(inout numbers: [Int]) -> () {
let numbersLength = numbers.count
for i in 0 ..< numbersLength {
for j in 1 ..< numbersLength-i {
if numbers[j-1] > numbers[j] {
let swap = numbers[j-1]
numbers[j-1] = numbers[j]
@seyhunak
seyhunak / AppDelegate.swift
Created Jun 5, 2016
Yet another GitHub sign in screen using MVVM
View AppDelegate.swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
window = UIWindow(frame: UIScreen.mainScreen().bounds)
let viewModel = LoginViewModel(provider: GitHubProvider)
let loginViewController = R.storyboard.main.loginViewController!
loginViewController.viewModel = viewModel
if let window = window {
window.rootViewController = loginViewController
window.makeKeyAndVisible()
View moya.swift
GitHubProvider.request(.UserRepositories(username), completion: { result in
var success = true
var message = "Unable to fetch from GitHub"
switch result {
case let .Success(response):
do {
let json: NSArray? = try response.mapJSON() as? NSArray
if let json = json {
@seyhunak
seyhunak / introrx.md
Created Oct 11, 2015 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
View introrx.md
View brewMVVM.swift
class Brew {
var temp: Float = 0.0
}
class BrewViewModel : NSObject {
var brew = Brew()
dynamic var temp: Float = 0.0 {
didSet {
self.brew.temp = temp
}
You can’t perform that action at this time.