Skip to content

Instantly share code, notes, and snippets.

View omgbbqhaxx's full-sized avatar
🪐
Universal

Yasin Aktimur omgbbqhaxx

🪐
Universal
View GitHub Profile
@omgbbqhaxx
omgbbqhaxx / Podfile
Last active September 9, 2016 09:16
platform :ios, '8.0'
use_frameworks!
target 'Hungr' do
pod 'QRCodeReader.swift', '~> 6.1.0'
pod 'SwiftyJSON', :git => 'https://github.com/IBM-Swift/SwiftyJSON.git'
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'swift3'
pod 'JSSAlertView'
pod 'ARSLineProgress', '~> 1.0'
pod 'Kingfisher', '~> 2.2'
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Get view controllers from storyboard
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let mainViewController = storyboard.instantiateViewControllerWithIdentifier("MainViewController") as! MainViewController
let sideViewController = storyboard.instantiateViewControllerWithIdentifier("SideViewController") as! SideViewController
let loginViewController = storyboard.instantiateViewControllerWithIdentifier("LoginViewController") as! LoginViewController
let sideNavigationViewController = SideNavigationViewController(mainViewController: mainViewController, leftViewController: sideViewController)
// Configure the window with the SideNavigationViewController as the root view controller
window = UIWindow(frame: UIScreen.mainScreen().bounds)
@omgbbqhaxx
omgbbqhaxx / tableView.swift
Last active July 15, 2019 08:38
TableViewBasics.
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 3
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
@omgbbqhaxx
omgbbqhaxx / timeback.swift
Created August 29, 2016 19:03
Swift open 5 minutes session.
//
// ViewController.swift
// TimeLapse
//
// Created by Yasin Aktimur on 29.08.2016.
// Copyright © 2016 Yasin Aktimur. All rights reserved.
//
import UIKit
@omgbbqhaxx
omgbbqhaxx / clean value.
Created August 27, 2016 11:10
Eğer float'ta noktadan sonraki basamaklar zaten sıfırsa bunu gösterme fakat başka bir rakamsa göster.
extension Float {
var cleanValue: String {
return self % 1 == 0 ? String(format: "%.0f", self) : String(self)
}
}
Usage:
var sampleValue: Float = 3.234
print(sampleValue.cleanValue)
@omgbbqhaxx
omgbbqhaxx / iOS Swift print all font names
Last active July 24, 2017 15:28 — forked from iamjason/iOS Swift print all font names
Prints out all of the Fonts available. (Helpful for using custom fonts)
for familyName in UIFont.familyNames as [String] {
print("\(familyName)")
for fontName in UIFont.fontNames(forFamilyName: familyName) as [String] {
print("\tFont: \(fontName)")
}
}
@omgbbqhaxx
omgbbqhaxx / RandomString.swift
Created August 23, 2016 11:07 — forked from gingofthesouth/RandomString.swift
Swift 2.2 Random String Generation
// based on https://gist.github.com/samuel-mellert/20b3c99dec168255a046
// which is based on https://gist.github.com/szhernovoy/276e69eb90a0de84dd90
// Updated to work on Swift 2.2
func randomString(length: Int) -> String {
let charactersString = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
let charactersArray : [Character] = Array(charactersString.characters)
var string = ""
for _ in 0..<length {
@omgbbqhaxx
omgbbqhaxx / timeago.swift
Created July 29, 2016 16:52 — forked from jacks205/timeago.swift
"Time ago" function for Swift (based on MatthewYork's DateTools for Objective-C) *Swift 2
func timeAgoSinceDate(date:NSDate, numericDates:Bool) -> String {
let calendar = NSCalendar.currentCalendar()
let now = NSDate()
let earliest = now.earlierDate(date)
let latest = (earliest == now) ? date : now
let components:NSDateComponents = calendar.components([NSCalendarUnit.Minute , NSCalendarUnit.Hour , NSCalendarUnit.Day , NSCalendarUnit.WeekOfYear , NSCalendarUnit.Month , NSCalendarUnit.Year , NSCalendarUnit.Second], fromDate: earliest, toDate: latest, options: NSCalendarOptions())
if (components.year >= 2) {
return "\(components.year) years ago"
} else if (components.year >= 1){
@omgbbqhaxx
omgbbqhaxx / 00.howto_install_phantomjs.md
Last active May 13, 2016 21:26 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@omgbbqhaxx
omgbbqhaxx / install-comodo-ssl-cert-for-nginx.rst
Last active July 9, 2018 14:57 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo


Prior to purchasing a cert, you need to generate a private key, and a CSR file (Certificate Signing Request). You'll be asked for the content of the CSR file when ordering the certificate.