Skip to content

Instantly share code, notes, and snippets.

@tomkrush
tomkrush / acf-state-options
Created November 14, 2013 21:00
List of states for Advanced Custom Field
AL : Alabama
AK : Alaska
AZ : Arizona
AR : Arkansas
CA : California
CO : Colorado
CT : Connecticut
DE : Delaware
FL : Florida
GA : Georgia
@tomkrush
tomkrush / gist:5970417
Last active December 19, 2015 14:39
SASS Responsive Mixin
$rwd-tablet: "only screen and (max-width: 980px)";
$rwd-tablet-only: "only screen and (max-width: 980px) and (min-width: 740px)";
$rwd-small-tablet: "only screen and (max-width: 740px)";
$rwd-small-tablet-only: "only screen and (max-width: 740px) and (min-width: 600px)";
$rwd-wide-mobile: "only screen and (max-width: 600px)";
$rwd-wide-mobile-only: "only screen and (max-width: 600px) and (min-width: 480px)";
$rwd-mobile: "only screen and (max-width: 480px)";
@tomkrush
tomkrush / paginate.scss
Created February 28, 2013 16:12
Paginate Mixin
@mixin paginate($backgroundColor: false, $textColor: #000, $selectedBackgroundColor: #000, $selectedTextColor: #fff) {
.pagination {
clear: both;
width: 100%;
overflow: hidden;
padding: 10px 0 1px 0;
margin: 20px 0 20px 0;
@include box-sizing(border-box);
@tomkrush
tomkrush / event
Created February 13, 2013 19:27
Calendar event class for outputting an ics event file.
class CalendarEvent
{
public $description;
public $start;
public $end;
public function data()
{
$format = 'Ymd\THis';
@tomkrush
tomkrush / gist:3208771
Created July 30, 2012 18:08
Responsive CSS Template
@media only screen and (max-width: 959px) { /* iPad */
}
@media only screen and (max-width: 719px) { /* Kindle */
}
@media only screen and (max-width: 599px) { /* Wide Phone */
@tomkrush
tomkrush / .gitignore
Created July 11, 2012 21:41
Xcode .gitignore
# Exclude the build directory
build/*
# Exclude temp nibs and swap files
*~.nib
*.swp
# Exclude OS X folder attributes
.DS_Store
@tomkrush
tomkrush / gist:2208677
Created March 26, 2012 18:54
Simple Dropdown.
function dropdown($name, $options, $value, $keys = FALSE, $attrs = array()) {
$attributes = array();
foreach($attrs as $key => $attr)
{
$attributes[] = $key."=\"".$attr."\"";
}
echo '<select name="'.$name.'" '.implode(' ', $attributes).'>';
if ( $keys == TRUE )
<?php
if ( ! function_exists('mailer') )
{
function mailer($to, $from, $subject, $template, $data = array())
{
$headers = "Content-Type: text/html; charset=UTF-8\r\n";
$headers .= "From: {$from}\r\n";
$path = get_theme_root() . '/' . get_template() . '/';
@tomkrush
tomkrush / gist:1429057
Created December 4, 2011 03:31
Example of class_name
class Post_Model extends My_Model
{
public function init()
{
$this->belongs_to('contributor', array(
'class_name' => 'User_Model',
'foreign_key' => 'contributor_id'
));
$this->belongs_to('editor', array(
@tomkrush
tomkrush / gist:1149816
Created August 16, 2011 18:40
CodeIgniter Jot Migration for Sessions
<?php
class Create_Table_Sessions
{
function up()
{
create_table('ci_sessions', array(
array('name' => 'session_id', 'type' => 'varchar(40)', 'DEFAULT' => '0', 'NOT NULL' => TRUE),
array('name' => 'ip_address', 'type' => 'varchar(16)', 'DEFAULT' => '0', 'NOT NULL' => TRUE),
array('name' => 'user_agent', 'type' => 'varchar(50)', 'NOT NULL' => TRUE),
array('name' => 'last_activity', 'type' => 'int(10)', 'UNSIGNED' => TRUE, 'DEFAULT' => '0', 'NOT NULL' => TRUE),