Skip to content

Instantly share code, notes, and snippets.

View omgbbqhaxx's full-sized avatar
🪐
Universal

Yasin Aktimur omgbbqhaxx

🪐
Universal
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Simple markers</title>
<style>
html, body, #map-canvas {
height: 100%;
margin: 0;
@omgbbqhaxx
omgbbqhaxx / gist:c6b4cf0d7ea134a9ed45
Last active August 29, 2015 14:27 — forked from mikeyk/gist:1329319
Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
@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.

@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 / 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 / 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 / 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 / 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 / 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 / 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 {