Skip to content

Instantly share code, notes, and snippets.

View zbrox's full-sized avatar

Rostislav zbrox

View GitHub Profile
@zbrox
zbrox / uicolorFromHex.swift
Last active August 29, 2015 14:05 — forked from shadcn/gist:de147c42d7b3063ef7bc
Create a UIColor instance from a HEX colour definition (as of Swift beta 4)
func colorWithHexString (hex:String) -> UIColor {
var cString:String = hex.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()).uppercaseString
if (cString.hasPrefix("#")) {
cString = cString.substringFromIndex(advance(cString.startIndex, 1))
}
if (countElements(cString) != 6) {
return UIColor.grayColor()
}
@zbrox
zbrox / iso_array.php
Last active December 22, 2015 14:38 — forked from brianherbert/iso_array.php
ISO 3166-1 alpha-3 countries list as a PHP array sorted by country name, not country code. I've added Scotland (SCO) and England (ENG), because for the purpose I needed it I couldn't go with just Great Britain (GB).
<?php
$iso_array = array (
'AFG' => 'Afghanistan',
'ALB' => 'Albania',
'DZA' => 'Algeria',
'ASM' => 'American Samoa',
'AND' => 'Andorra',
'AGO' => 'Angola',
'AIA' => 'Anguilla',
'ATA' => 'Antarctica',
@zbrox
zbrox / Gemfile
Created September 13, 2012 18:53
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
gem "tzinfo"
# Let's use thin