Skip to content

Instantly share code, notes, and snippets.

View licvido's full-sized avatar

Filip Mikovcak licvido

View GitHub Profile
@licvido
licvido / ssh.sh
Created March 29, 2015 19:08
SSH: Generate CSR (certificate signing request)
openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr
@licvido
licvido / countries.php
Created March 29, 2015 18:40
PHP array of countries
<?php
$countryList = array(
"AF" => "Afghanistan",
"AL" => "Albania",
"DZ" => "Algeria",
"AS" => "American Samoa",
"AD" => "Andorra",
"AO" => "Angola",
"AI" => "Anguilla",
@licvido
licvido / date.sql
Created March 29, 2015 18:39
SQL: Date table
CREATE TABLE `date` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`date` date NOT NULL,
`day` tinyint(2) unsigned NOT NULL,
`month` tinyint(2) unsigned NOT NULL,
`year` year(4) NOT NULL,
`day_of_week` tinyint(1) unsigned NOT NULL COMMENT '1 = monday, 7 = sunday',
`day_of_year` smallint(3) unsigned NOT NULL COMMENT 'starting from 0 to 365',
`week` tinyint(2) unsigned NOT NULL,
PRIMARY KEY (`id`)
@licvido
licvido / code.sh
Created March 10, 2015 23:11
SSH: Generating key for git
ssh-keygen -t rsa -C "[email protected]"
@licvido
licvido / gist:01d02b090a8c54a35f4f
Created March 10, 2015 23:10
GIT: Create repo in existing project
git init
git add .
git commit -m 'initial commit'
git remote add origin [email protected]:user/repo.git
git push origin master
@licvido
licvido / .gitignore
Created March 10, 2015 22:50
Gitignore for Xcode 6
# OS X Finder
.DS_Store
# Xcode per-user config
*.mode1
*.mode1v3
*.mode2v3
*.perspective
*.perspectivev3
*.pbxuser
@licvido
licvido / app.swift
Created March 9, 2015 20:57
SWIFT: UITableView sections example
import UIKit
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet var tableView: UITableView!
var itemsInSections: Array<Array<String>> = [["1A", "1B", "1C"], ["2A", "2B"], ["3A", "3B", "3C", "3D", "3E"]]
var sections: Array<String> = ["Section 1", "Section 2", "Section 3"]
@licvido
licvido / app.swift
Created March 7, 2015 15:01
SWIFT: Change text (or hide) of back button in navigation
// in controller returned to
let backButton = UIBarButtonItem(title: "Home/Return or nohing", style: .Bordered, target: nil, action: nil)
navigationItem.backBarButtonItem = backButton
@licvido
licvido / app.swift
Last active August 29, 2015 14:15
SWIFT: Next ID for CoreData row
var appDelegate = UIApplication.sharedApplication().delegate as AppDelegate
var context = appDelegate.managedObjectContext
var request = NSFetchRequest(entityName: "Entity")
request.fetchLimit = 1
request.sortDescriptors = [NSSortDescriptor(key: "id", ascending: false)]
var error: NSError? = nil
let entities = context.executeFetchRequest(request, error: &error) as [Entity]
@licvido
licvido / app.swift
Created February 3, 2015 23:18
SWIFT: Fade when changing UIImageView's image
let toImage = UIImage(named:"image.png")
UIView.transitionWithView(self.imageView,
duration:5,
options: .TransitionCrossDissolve,
animations: { self.imageView.image = toImage },
completion: nil)