Skip to content

Instantly share code, notes, and snippets.

English short name lower case Alpha-2 code Alpha-3 code Numeric code ISO 3166-2
Afghanistan AF AFG 004 ISO 3166-2:AF
Åland Islands AX ALA 248 ISO 3166-2:AX
Albania AL ALB 008 ISO 3166-2:AL
Algeria DZ DZA 012 ISO 3166-2:DZ
American Samoa AS ASM 016 ISO 3166-2:AS
Andorra AD AND 020 ISO 3166-2:AD
Angola AO AGO 024 ISO 3166-2:AO
Anguilla AI AIA 660 ISO 3166-2:AI
Antarctica AQ ATA 010 ISO 3166-2:AQ
@radcliff
radcliff / kinds.json
Last active August 29, 2015 14:25
Lemons - Items kinds (types)
{
"kinds": [
{
"option": "Lemons",
"value": "lemons"
},
{
"option": "Tomatoes",
"value": "tomatoes"
},
@radcliff
radcliff / spreadsheet-test.rb
Last active August 29, 2015 14:25
Design a spreadsheet engine in Ruby
require 'spreadsheet'
require 'minitest/autorun'
class TestSpreadsheet < MiniTest::Test
def setup
@sheet = Spreadsheet.new([2,2], "Sheet")
end
def test_for_iniatialize
assert_equal(2, @sheet.rows)
@radcliff
radcliff / multiplication-table-test.rb
Last active August 29, 2015 14:25
Print out a multiplication table
require 'multiplication-table'
require 'minitest/autorun'
class TestPrinter < MiniTest::Unit::TestCase
def test_for_create_table
table = create_mult_table(3)
assert_equal(3, table.size)
assert_equal(3, table[0].size)
assert_equal(9, table[2][2])
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@radcliff
radcliff / transform_pg_array.rb
Last active August 29, 2015 14:19
Transforming PostgreSQL arrays
# monkey patch String class
# source: http://drawingablank.me/blog/ruby-boolean-typecasting.html
class String
def to_bool
return true if self == true || self =~ (/^(true|t|yes|y|1)$/i)
return false if self == false || self.empty? || self =~ (/^(false|f|no|n|0)$/i)
raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
end
end
# Install Git needed for Git based gems
packages:
yum:
git: []
------------------------------------------------------------------------------------------------------------------------------
DESCRIPTION:
Notes for deploying TileStream on an AWS EC2 Ubuntu 12.04.2 Server for development. Includes workflow for creating
a local tile cache with TileMill, connecting to your Ubuntu EC2 server via SSH using Mac OSX Terminal, and uploading
your tiles (.mbtiles) to your TileStream server.
REFERENCES:
TileStream git repo: https://github.com/mapbox/tilestream
-----------------------------------------------------------------------------------------------------------------------------
@radcliff
radcliff / array.coffee
Created January 27, 2015 01:35
Object and Array Transforms for Ember-cli in CoffeeScript
`import DS from 'ember-data'`
ArrayTransform = DS.Transform.extend
deserialize: (serialized) ->
if (Ember.typeOf(serialized) is "array") then serialized else []
serialize: (deserialized) ->
type = Ember.typeOf(deserialized)
if type is "array"
deserialized
@radcliff
radcliff / .gitignore
Created January 21, 2015 00:10
One way to work with secrets in Python
credentials.yml