Skip to content

Instantly share code, notes, and snippets.

@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%; }
@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);

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 / 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) ) {
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, format: { with: VALID_EMAIL_REGEX }
@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" }");
}
@leekiernan
leekiernan / slate
Last active December 16, 2015 05:09
# This is the default .slate file.
# If no ~/.slate file exists this is the file that will be used.
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
# Push Bindings
bind right:ctrl;cmd;shift push right bar-resize:screenSizeX/3
bind left:ctrl;cmd;shift push left bar-resize:screenSizeX/3
[alias]
st = status
ci = commit
cl = clone
br = branch
co = checkout
df = diff
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
who = shortlog -s --
graphviz = "!f() { echo 'digraph git {' ; git log --pretty='format: %h -> { %p }' \"$@\" | sed 's/[0-9a-f][0-9a-f]*/\"&\"/g' ; echo '}'; }; f"
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100% }
form { position:absolute; top:0; z-index:50; width:100%; }
input { width:100%; height:40px; border:none; padding:1px 10px; }
<?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) ) {