Skip to content

Instantly share code, notes, and snippets.

View idlefingers's full-sized avatar

Damien Timewell idlefingers

View GitHub Profile
def check_postcode(postcode)
alpha1 = "[abcdefghijklmnoprstuwyz]"
alpha2 = "[abcdefghklmnopqrstuvwxy]"
alpha3 = "[abcdefghjkstuw]"
alpha4 = "[abehmnprvwxy]"
alpha5 = "[abdefghjlnpqrstuwxyz]"
postcode_expressions = [
%r{^(#{alpha1}{1}#{alpha2}?[0-9]{1,2})(\s*)([0-9]{1}#{alpha5}{2})$}, # AN NAA, ANN NAA, AAN NAA, and AANN NAA
%r{^(#{alpha1}{1}[0-9]{1}#{alpha3}{1})(\s*)([0-9]{1}#{alpha5}{2})$}, # ANA NAA
<div class='category ' id='category_1032'>
<h3 class='name'><a href="/categories/desktop-accessories-clipboards.html">Clipboards</a></h3>
<div class='image'><a href="/categories/desktop-accessories-clipboards.html" id="subcategory_image_1032"><img alt="Clipboards" src="http://www.officekitten.co.uk/images/products/536552/extra_small.jpg?1271253611" /></a></div>
<div class='product_count'>28 items</div>
</div>
This works, but not if you click on 'product_count'
/* merry actual christmas - comment this out after chrimbo is over
body {
background: url(images/snowback.jpg) repeat-x scroll 0px 89px ! important;
}
end of merry actual christmas */
@idlefingers
idlefingers / deploy.rb
Created December 19, 2010 18:26 — forked from jeronimo/deploy.rb
set :sync_directories, ["public/system/images"]
set :sync_backups, 3
set :db_file, "mongoid.yml"
set :db_drop, '--drop' # drop database (rewrites everything)
@idlefingers
idlefingers / rails_remplate.rb
Created February 4, 2011 15:08
Simple Rails app template to create a new app with Rspec, Steak, Devise and a few useful helpers
app_name = ARGV[0].humanize
# Remove unwanted files
remove_file "public/index.html"
remove_file "public/favicon.ico"
remove_file "public/images/rails.png"
remove_file "public/robots.txt"
# Add gems to Gemfile
append_to_file 'Gemfile', %Q{
class Hash
def has_nested_keys?(*args)
args.inject(self) do |hash,key|
hash.fetch key, nil
end
end
end
hash = {a: {b: {c: 1}}}
hash.has_nested_keys? :a, :b, :c # => true
@idlefingers
idlefingers / part-1.md
Created October 16, 2015 14:37
Tjejer Kodar Todo App Guide

Part 1: Creating the project

In this part of the guide we will setup the basic project structure, with an empty HTML document and configure babel to compile our JSX templates.

Installing prerequisites

We need to install nodejs and babel so we can compile our JSX (React) code. If you have already installed nodejs, you can skip this section!

For Mac users:

{
"name": "",
"type": "Billboard",
"tags": {
"position": "body"
},
"elements": {
"title": {
"type": "Text",
"reference": "a3087414-b1d3-459a-8cd1-bb1d502e9345",
int redLed = 2;
int redButton = 11;
int greenLed = 3;
int greenButton = 10;
int yellowLed = 4;
int yellowButton = 9;
int blueLed = 5;
int blueButton = 8;
int leds[] = { redLed, greenLed, yellowLed, blueLed };
int redLed = 2;
int greenLed = 3;
int yellowLed = 4;
int blueLed = 5;
int redButton = 11;
int greenButton = 10;
int yellowButton = 9;
int blueButton = 8;