Skip to content

Instantly share code, notes, and snippets.

View beaucharman's full-sized avatar
💭
🦄 Hackin'

Beau beaucharman

💭
🦄 Hackin'
View GitHub Profile
@beaucharman
beaucharman / event.js
Last active December 14, 2015 18:09
event{} | JavaScript object | Cross Browser Event Handling
/**
* Event
* ------------------------------------------------------------------------
* event{}
* @version 1.0 | April 23rd 2013
* @author Beau Charman | @beaucharman | http://beaucharman.me
* @link https://gist.github.com/beaucharman/5127116
* @method add
* @method remove
* @method getTarget
@beaucharman
beaucharman / simple-capture-form.php
Last active February 4, 2016 00:52
Takes data from a from and creates and email, also adds an attachment.
<?php
/**
* Simple Capture Form
*
* <input type="hidden" name="first_name" value="" />
* <input type="hidden" name="form_submitted" value="true" />
*
* May need to consider using https://github.com/PHPMailer/PHPMailer
* with an SMTP server if mail from this form goes to spam folder
*/
@beaucharman
beaucharman / ajax.demo.js
Last active December 16, 2015 05:29
ajax{} | JavaScript object | AJAX methods object
// examples
;(function () {
ajax.json('file.php', {best: "cats", awesome: "javascript"}, function (json) {
var foo = document.getElementById('foo');
for (var ii = 0, len = json.length; ii < len; ii++) {
foo.innerHTML += '<li>' + json[ii].name + ': ' + json[ii].details + '</li>';
}
});
@beaucharman
beaucharman / roundTo.js
Last active December 16, 2015 07:49
roundTo( ) | JavaScript function | A JavaScript function that returns a float to a given number of decimal places, can also transpose the decimal place if needed.
/**
* RoundTo
* ------------------------------------------------------------------------
* roundTo()
* @version 1.0 | April 18th 2013
* @author Beau Charman | @beaucharman | http://www.beaucharman.me
* @link https://gist.github.com/beaucharman/5401683
* @param {float} n | the subject number we are rounding
* @param {integer} d | the number to decimal places to round to
* @param {string} dir | 'round', 'floor' or 'ceil'
@beaucharman
beaucharman / _rhythm.scss
Last active January 1, 2016 07:41
rhythm() | Sass function | Creates a funky vertical rhythm.
/**
* Rhythm
* ------------------------------------------------------------------------
* rhythm()
* @version 1.0 | April 25th 2013
* @author Beau Charman | @beaucharman | http://www.beaucharman.me
* @link https://gist.github.com/beaucharman/5459188/
* @param {em} $fontsize | em unit value
* @param {float} $lineheight | decimal value
* @return {em} em unit value
@beaucharman
beaucharman / equalHeight.js
Last active December 20, 2015 03:59
Apply equal height to a group of provided elements, based on the tallest element
/**
* Equal Height
* ======================================================================== */
(function ($) {
$.fn.equalheight = function () {
var tallest = 0;
var height = 0;
//var offest = 0;
var $elements = $(this);
var resizeElements = function () {
@beaucharman
beaucharman / getQueryVars.js
Last active December 20, 2015 18:19
getQueryVars.js
/**
* Get Query Vars
*/
var getUrlVars = function () {
var vars = [];
var hash;
var href = window.location.href;
if (href.indexOf('#') !== -1) {
href = href.substr(0, href.indexOf('#'));
}
@beaucharman
beaucharman / ACF_Layout.php
Last active May 10, 2022 21:27
Logical layout automation for Advanced Custom Fields and it's Flexible Content Field add on. http://www.advancedcustomfields.com/ http://www.advancedcustomfields.com/add-ons/flexible-content-field/
<?php
/**
* ACF Layout
* @version 1.0 | November 12th 2013
* @author Beau Charman | http://twitter.com/beaucharman
* @link https://gist.github.com/beaucharman/7181406
* @license MIT license
*
* Logical layout automation for Advanced Custom Fields and it's Flexible Content Field add on.
/**
* accessibleDropDownMenu.js
*
* jquery.accessibleDropDownMenu.js
* @version 2.0 | 14th January 2014
* @author Beau Charman | @beaucharman | http://www.beaucharman.github.io
* @link https://gist.github.com/beaucharman/7348970 |
* http://jsfiddle.net/beaucharman/X2ArC/
* @license MIT license
*/
@beaucharman
beaucharman / jquery.equalHeightColumns.js
Last active December 31, 2015 09:49
Responsive, Equal Height Columns
/**
*
* Equal Height Columns
*
* Horizontally Even Columns
*
* @param {object}
* @param {boolean} 'responsive'
* @param {integer} 'responsiveDelay'
* @param {string} 'bindTo'