Skip to content

Instantly share code, notes, and snippets.

@mixin background-image-or-2x($image) {
@media (-webkit-min-device-pixel-ratio: 2), (min-device-width: 1800px)
{
background-image: url("#{ $image + "[email protected]" }");
}
background-image: url("#{ $image + ".png" }");
}
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, format: { with: VALID_EMAIL_REGEX }
@leekiernan
leekiernan / form processing
Created April 5, 2013 12:23
Form processing, work in progress. PHP
<?php
date_default_timezone_set('UTC');
class Form {
protected $dbh, $db_table;
protected $required_data, $received_data, $errors;
public $email_body, $email_template, $email_to, $email_subject, $email_from;
public function __construct( $connection_data = null ) {
if( isset($connection_data) ) {

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

@leekiernan
leekiernan / page_change.js
Created March 20, 2013 23:09
JS animate page change
// Animate page change.
$(function() {
$.fn.slideTo = function(data) {
var width = parseInt( $('.main').css('width') );
var transfer = $('<div class="transfer"></div>').css({ 'width': (2 * width) + 'px', "overflow": "hidden"});
var current = $('<div class="current"></div>').css({ 'width': width + 'px', 'left': '0', 'float': 'left' }).html( $('.main').html() );
var next = $('<div class="next"></div>').css({ 'width': width + 'px', 'left': width + 'px', 'float': 'left' }).html(data);
transfer.append(current).append(next);
@leekiernan
leekiernan / _grid.scss
Created March 20, 2013 22:59
Using OOCSS with SCSS. OOSCSS if you will!
%line { overflow:hidden; *overflow:visible; *zoom:1; }
%unit { float:left; }
%size1of1 { float:none; }
%size1of2 { width:50%; }
%size1of3 { width:33.33333%; }
%size2of3 { width:66.66666%; }
%size1of4 { width:25%; }
%size3of4 { width:75%; }
%size1of5 { width:20%; }
%size2of5 { width:40%; }