This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'http://rubygems.org' | |
gem 'rails', '3.1.8' | |
# Gems used only for assets | |
group :assets do | |
gem 'sass-rails' | |
gem 'coffee-rails' | |
gem 'uglifier' | |
gem 'bourbon' # a comprehensive library of sass mixins (see https://github.com/thoughtbot/bourbon) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on the format described in this Wikipedia article: http://en.wikipedia.org/wiki/Personal_identification_number_(Denmark) | |
"#{(20.years.ago - (0..11000).to_a.sample.days).strftime('%d%m%y')}-1#{'%03d' % (0..999).to_a.sample}" | |
# Regular expression to validate a CPR number | |
/\b(0[1-9]|[12]\d|3[01])(0[1-9]|1[0-2])\d{2}-\d{4}\b/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate Twitter Bootstrap icons with a minimum of fuss | |
# Use in views like so: | |
# icon('pencil') => content_tag(:i, '', class: 'icon-pencil') | |
# icon('trash', 'icon-white huge') => content_tag(:i, '', class: 'icon-trash icon-white huge') | |
def icon(style, extra_class = nil) | |
content_tag(:i, '', class: "icon-#{style}" + (extra_class ? " #{extra_class}" : '')) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
["Ækvatorialguinea", "Afghanistan", "Albanien", "Algeriet", "Amerikansk Samoa", "Andorra", "Angola", "Anguilla", "Antarktis", | |
"Antigua og Barbuda", "Argentina", "Armenien", "Aruba", "Aserbajdsjan", "Australien", "Bahamas", "Bahrain", "Bangladesh", | |
"Barbados", "Belarus", "Belgien", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnien-Hercegovina", "Botswana", | |
"Bouvetø", "Brasilien", "Brunei", "Bulgarien", "Burkina Faso", "Burundi", "Côte d'Ivoire", "Cambodja", "Cameroun", "Canada", | |
"Caymanøerne", "Chile", "Cocosøerne (Keelingøerne)", "Colombia", "Comorerne", "Congo", "Cookøerne", "Costa Rica", "Cuba", | |
"Cypern", "Danmark", "De Amerikanske Jomfruøer", "De Britiske Jomfruøer", "De Forenede Arabiske Emirater", | |
"De Franske Besiddelser i Det Sydlige Indiske Ocean", "De Mindre Amerikanske Oversøiske Øer", "De Nederlandske Antiller", | |
"Den Centralafrikanske Republik", "Den Dominikanske Republik", "Den Tidligere Jugoslaviske Republik Makedonien", | |
"Det Britiske Territorium i Det Indiske Ocean", "Det Forene |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"keys": ["escape"], | |
"command": "alternative_autocomplete", | |
"context": [ | |
{"key": "num_selections", "operator": "equal", "operand": 1}, | |
{"key": "overlay_visible", "operator": "equal", "operand": false}, | |
{"key": "panel_visible", "operator": "equal", "operand": false}, | |
{"key": "has_prev_field", "operator": "equal", "operand": false}, | |
{"key": "has_next_field", "operator": "equal", "operand": false}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@from_date = Date.parse("1/10/2013") | |
@to_date = Date.parse("31/10/2013") | |
date_range = [*@from_date..@to_date] | |
prepend = (date_range)[0].wday # 2 | |
append = (date_range)[-1].wday # 4 | |
weeks = (date_range).unshift(*2..prepend).push(*2..append).each_slice(7).to_a | |
# [ | |
# [0] [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
colour = "##{((0..6).map{rand(256).chr}*'').unpack('H*')[0][0,6]}" | |
# => "#9ee5a3" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# - A `Thing` can be 1% - 100% green | |
# - This is represented on the front end with a doughnut chart | |
# - The doughnut chart can't be generated since it's in an email | |
# - To get around this, we have 25 static doughnut images in increments of 4% | |
# This code takes the percentage and returns the relevant image. | |
# I'm sure there must be a more sensible way of doing this than using the | |
# world's longest switch statement. Any ideas? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
box: wercker/ruby | |
services: | |
- wunki/[email protected] | |
- wercker/postgresql | |
build: | |
steps: | |
# Taken from https://gist.github.com/pjvds/6008266 | |
- script: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
execute pathogen#infect() | |
syntax on | |
filetype plugin indent on | |
" 256 colours, please | |
set t_Co=256 | |
" Dark twilight scheme | |
set background=dark | |
colorscheme twilight256 |