Skip to content

Instantly share code, notes, and snippets.

@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: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 / 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 / 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 / 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 / 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:7491605
Last active December 28, 2015 11:09
Respond To for javascript
function respondsTo(respondToSize, callback, undoCallback) {
if ( typeof respondToSize === 'string' )
{
respondToSize = [respondToSize];
}
function calculateSize()
{
var width = jQuery('body').width();
var size = 'desktop';
@tomkrush
tomkrush / gist:8579549
Last active January 4, 2016 06:08
SASS mixin for handling media queries.
$rwd-desktop: "only screen and (min-width: 1024px)";
$rwd-tablet-device: "only screen and (max-device-width: 980px)";
$rwd-mobile-device: "only screen and (max-device-width: 600px)";
$rwd-tablet: "only screen and (max-width: 980px)";
$rwd-tablet-only: "only screen and (min-width: 740px) and (max-width: 980px)";
$rwd-small-tablet: "only screen and (max-width: 740px)";
$rwd-small-tablet-only: "only screen and (min-width: 600px) and (max-width: 740px)";
@tomkrush
tomkrush / query_var.php
Last active January 4, 2016 20:39
add query vars to page num link
<?php
function edg_get_pagenum_link_query_vars($query_vars) {
$query_vars['test'] = 'asdf';
return $query_vars;
}
add_filter('get_pagenum_link_query_vars', 'edg_get_pagenum_link_query_vars');
@tomkrush
tomkrush / columns.php
Created February 7, 2014 21:05
Calculating Columns
<?php
function calculateColumnWidth($maxWidth, $columns, $gutter, $margin) {
return floor(($maxWidth-(($columns - 1) * $gutter + 2 * $margin)) / $columns);
}
echo calculateColumnWidth(960, 5, 20, 0);