Skip to content

Instantly share code, notes, and snippets.

View kcrwfrd's full-sized avatar

Kevin Crawford kcrwfrd

View GitHub Profile
@kcrwfrd
kcrwfrd / functions.php
Created January 10, 2011 22:15
Automatically define page ID & class based on file name and folder structure
<?php
// Default Page Title
$page_title = "Default Page";
// Set relative URL
$url = '/';
// Set $page_id & $page_class
$page_id = $page_class = '';
@kcrwfrd
kcrwfrd / reset.css
Created January 10, 2011 22:19
Eric Meyer's Reset
/* http://meyerweb.com/eric/tools/css/reset/ */
/* v1.0 | 20080212 */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
@kcrwfrd
kcrwfrd / gist:839271
Created February 22, 2011 20:04
O'Brien Homes Quick-Search Data
var quickSearch;
quickSearch.data = {
"communities": [
{
"name": "Arroyo Crossing",
"minSqFt": 1858,
"maxSqFt": 4428,
"minBed": 2,
"maxBed": 5,
"minPrice": 600000,
$xml = simplexml_load_file($_SERVER['DOCUMENT_ROOT'] . $url . "hotw-admin/xml/hotw.xml");
$element = $xml->xpath("//hotw[@id='" . $_GET['id'] . "']");
$element = $element[0];
$element['id'] = $_POST['id'];
$element->homesite = $_POST['homesite'];
$element->residence = $_POST['residence'];
$element->sqft = $_POST['sqft'];
$element->bed = $_POST['bed'];
$element->bath = $_POST['bath'];
@kcrwfrd
kcrwfrd / accordion.html
Created March 21, 2011 23:28
Accordion
<ul id="accordion">
<li class="new-homes">
<a href="#"><span>New Homes</span></a>
</li>
<li class="lifestyle">
<a href="#"><span>Lifestyle</span></a>
</li>
<li class="country-club last">
$(document).ready(function(){
$('#register').colorbox({
inline: true,
close: "close [x]",
scrolling: false,
onComplete: function(){
$('#registration-form').validate({
invalidHandler: function(form, validator) {
setTimeout(function(){ $.colorbox.resize(); }, 1);
@kcrwfrd
kcrwfrd / submit.php
Last active July 5, 2016 09:13
Form POST Submit to remote processor via cURL
<?php
/**
* FormTools Spam Honeypot
*
* Use in conjunction with a form field like
* <input type="text" id="url_2" name="url_2" />
* And then hide the field using CSS. If the field gets filled out,
* then it was a spam bot that did it, and we can ignore the submission.
* Otherwise, we use cURL to send the submission on to our FormTools application
* at http://forms.epraxa2.com
@kcrwfrd
kcrwfrd / gist:2407899
Created April 17, 2012 18:09
Array Sorter Function - Sort by Nested Key
<?php
$a = array(
array('community_id'=>5, 'community_name'=>'Meadows'),
array('community_id'=>7, 'community_name'=>'Grosse Pointe'),
array('community_id'=>12, 'community_name'=>'Mountain View'),
array('community_id'=>6, 'community_name'=>'Seaside'),
);
function buildSorter($key) {
@kcrwfrd
kcrwfrd / fb-invite.js
Created May 30, 2012 05:24
FB Invite
javascript:
var jq = '';
var myInit = function(){
jq = document.createElement('script'); jq.type = 'text/javascript'; jq.async = false;
jq.src = '//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js';
document.getElementsByTagName('head')[0].appendChild(jq);
}();
jq.addEventListener('load', function(e){
@kcrwfrd
kcrwfrd / toggle.js
Created October 26, 2012 16:25
jQuery Toggle
$("a").click(function(e){
e.preventDefault();
var toggle = ($(this).data('toggle') == undefined) ? true : $(this).data('toggle');
$("#console").append("<p>"+toggle+"</p>");
$(this).data('toggle', !toggle);
});​