Skip to content

Instantly share code, notes, and snippets.

View thetrickster's full-sized avatar

Chris Matthias thetrickster

View GitHub Profile
@thetrickster
thetrickster / config.rb
Created January 31, 2014 02:03
Compass Wordpress Theme SCSS Helper -- This updated config.rb file has a ruby method that compiles /scss/styles.scss and copies the style.css file out of /scss/ and into the project root. Works best for a WP theme development workflow.
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "stylesheets"
sass_dir = "scss"
images_dir = "images"
javascripts_dir = "javascripts"
# You can select your preferred output style here (can be overridden via the command line):
function xf_insert_image( $html, $id, $caption, $title, $align, $url )
{
$html5 = "<figure id='post-$id media-$id' class='align-$align'>";
$html5 .= "<img src='$url' alt='$title' />";
$html5 .= "<figcaption>$caption</figcaption>";
$html5 .= "</figure>";
return $html5;
}
@thetrickster
thetrickster / cf7-us-state-dropdown-code.txt
Last active August 29, 2015 14:05
Contact Form 7 (CF7) US State Dropdown with piping-- Shows full State name to user but passes only state abbreviation to form. Allows for more accurate state capture by removing abbreviations for frontend user and using select removes typos.
[select state include_blank "Alabama|AL" "Alaska|AK" "Arizona|AZ" "Arkansas|AR" "California|CA" "Colorado|CO" "Connecticut|CT" "Delaware|DE" "Florida|FL" "Georgia|GA" "Hawaii|HI" "Idaho|ID" "Illinois|IL" "Indiana|IN" "Iowa|IA" "Kansas|KS" "Kentucky|KY" "Louisiana|LA" "Maine|ME" "Maryland|MD" "Massachusetts|MA" "Michigan|MI" "Minnesota|MN" "Mississippi|MS" "Missouri|MO" "Montana|MT" "Nebraska|NE" "Nevada|NV" "New Hampshire|NH" "New Jersey|NJ" "New Mexico|NM" "New York|NY" "North Carolina|NC" "North Dakota|ND" "Ohio|OH" "Oklahoma|OK" "Oregon|OR" "Pennsylvania|PA" "Rhode Island|RI" "South Carolina|SC" "South Dakota|SD" "Tennessee|TN" "Texas|TX" "Utah|UT" "Vermont|VT" "Virginia|VA" "Washington|WA" "West Virginia|WV" "Wisconsin|WI" "Wyoming|WY"]
@thetrickster
thetrickster / cf7-custom-validations.md
Last active August 29, 2015 14:18
Contact Form 7 4.1 Custom Validations Fix/Error
@thetrickster
thetrickster / gist:5470271
Last active December 16, 2015 17:29
On facebook Like button event, enable form.fb-like-form input elements
// Setup a variable to contain all the form input elements to enable
var myDisabledFields = "input, textarea, select, button";
// The FB.Event.subscribe method lets us run some javascript on certain events. The "Like" event for the Javascript SDK is "edge.create"
FB.Event.subscribe('edge.create',
// Once we're subscribed, anytime the Like button is cliked Facebook sends us back some data in an array.
// We'll call that data array "response".
function(response) {
// If you uncomment the next line, you'll see the data returned in your console
@thetrickster
thetrickster / random-web-app-items.html
Last active December 18, 2015 03:29
Business Catalyst Multiple Random Web App Items - Add this code to your page where you want the random items to appear.
<!--
The element where your web app items will be appended to.
By default the script looks for an id of "random-web-app-items"
IMPORTANT: jQuery must be loaded on the page either in the HEAD of the doc or before you call the SCRIPTS below.
-->
<div id="random-web-app-items"></div>
<!-- Download this script to your site and replace the SRC with the path to your site's javascript file -->
<script src="//gist.github.com/thetrickster/5718857/raw/f0d736a4f80248c9c1a4184dcc43e223ac1e1d03/random-web-app-items.js"></script>
@thetrickster
thetrickster / random-web-app-items.tpl
Last active December 18, 2015 03:29
Business Catalyst Multiple Random Web App Items - Custom Module Template See comments below.
webAppItems.push({id: {tag_itemid}, name: "{tag_name_nolink}", url: "{tag_itemurl_nolink}", image: "{tag_image_value}"});
@thetrickster
thetrickster / random-web-app-items.js
Last active December 18, 2015 03:29
BC Multiple Random Web App Items Script
Array.prototype.shuffle = function() {
var i = this.length, j, temp;
if ( i == 0 ) return this;
while ( --i ) {
j = Math.floor( Math.random() * ( i + 1 ) );
temp = this[i];
this[i] = this[j];
this[j] = temp;
}
return this;
@thetrickster
thetrickster / google-maps-v3.html
Created June 6, 2013 21:25
Asynchronous Google Maps v3
<!DOCTYPE html>
<html>
<head>
<title>Asynchronous Loading</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<link href="/maps/documentation/javascript/examples/default.css" rel="stylesheet">
<script>
function initialize() {
var mapOptions = {
@thetrickster
thetrickster / bc-workarounds-forum-list.md
Last active December 19, 2015 06:48
Links to important and hard-to-find BC workarounds on the help forums