Skip to content

Instantly share code, notes, and snippets.

View timkelty's full-sized avatar

Tim Kelty timkelty

View GitHub Profile
@media only screen and (min-width: 320px) {
/* Small screen, non-retina */
}
@media
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( -o-min-device-pixel-ratio: 2/1) and (min-width: 320px),
@jakebellacera
jakebellacera / mamp-mysql2-rbenv.md
Created August 22, 2012 20:29
Instructions on how to use MAMP with the mysql2 gem and Ruby 1.9.3-p194 via rbenv

How to use MAMP with the mysql2 gem and Ruby 1.9.3-p194 via rbenv

Let's say you're a web developer who happens to work with both MAMP and Ruby when building different types of websites. Let's say you also like to keep your MySQL stuff in one place and don't like having to juggle both a local MySQL install as well as a MAMP MySQL install. Well, you can indeed connect your ruby apps to MAMP's MySQL. Here's a tutorial on how to do it.

Important! Before you do anything, download and install MAMP. MAMP Pro will work as well. At the time of this writing, MAMP 2.1.1 is the latest.

First, install Ruby via rbenv

  1. Install homebrew
  2. Install rbenv: brew install rbenv, follow any instructions homebrew gives you after the installation is complete.
@objectivehtml
objectivehtml / index.html
Created June 18, 2012 16:53
Simple Stash Embed Usage
{exp:stash:set type="snippet"}
{stash:search_header}
<input type="hidden" name="current_page" value="{current_page}" />
<input type="hidden" name="total_pages" value="{total_pages}" />
<section class="clear products grid">
<div class="sort orange row">
@croxton
croxton / gist:1931841
Created February 28, 2012 10:45
JSONP with ExpressionEngine - core hack
Currently you're stuck if you need to return JSONP from a EE template, because appending callback=? to your uri will make EE throw an Invalid Get Date error. In case you didn't know, JSONP is a great way to do cross-domain AJAX and let your EE website function as a web service.
To get round this restriction in EE 2.4 amend line 116 of /system/expressionengine/core/EE_Input.php from:
elseif (preg_match("#(;|\?|exec\s*\(|system\s*\(|passthru\s*\(|cmd\s*\(|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#i", $val))
To:
elseif (preg_match("#(;|\?\S+|exec\s*\(|system\s*\(|passthru\s*\(|cmd\s*\(|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#i", $val))
This still gives you protection against the use of ? in query strings to pass arguments, but allows you to append a ? to the very end of your query only - which is all we need.
@mixin grid_container {
margin: auto;
width: 960px;
// Tablet Layout: 768px.
@media only screen and (min-width: 768px) and (max-width: 991px) {
width: 764px;
}
// Mobile Layout: 320px.
@media only screen and (max-width: 767px) {
@croxton
croxton / gist:1010797
Created June 6, 2011 18:41
ExpressionEngine Stash match/against example
{!-- get a list of people with last names starting A-F --}
{exp:channel:entries channel="people" sort="asc" orderby="person_lname"}
{exp:stash:append name="people_a_f" match="#^[A-F]#" against="{person_lname}"}
<li><a href="/people/{entry_url}" title="view profile">{title}</a></li>
{/exp:stash:append}
{/exp:channel:entries}
<?php
/*
EE2 hidden configuration variables
Last updated: Jun 20 2010
Obtain this list by putting print_r($this->EE->config->config); on a PHP-enabled template.
See: http://eeinsider.com/tips/view/config-overrides-for-ee-1-and-2/
*/