Skip to content

Instantly share code, notes, and snippets.

Tommy Marshall tommymarshall

Block or report user

Report or block tommymarshall

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View functions.php
function wp_api_encode_acf($data,$post,$context){
$data['meta'] = array_merge($data['meta'],get_fields($post['ID']));
return $data;
}
if( function_exists('get_fields') ){
add_filter('json_prepare_post', 'wp_api_encode_acf', 10, 3);
}
View thebookmarklet.js
javascript:(function () {
var d = document,
z = d.createElement('scr' + 'ipt'),
b = d.body;
try {
if (!b) throw (0);
d.title = '(Saving...) ' + d.title;
z.setAttribute('src', 'http://remote.url.to.your.js' + encodeURIComponent(d.location.href) + '&t=' + (new Date().getTime()));
b.appendChild(z);
} catch (e) {
@tommymarshall
tommymarshall / gist:3353506
Created Aug 14, 2012 — forked from greypants/gist:3185028
SCSS: keyframe mixins
View gist:3353506
// ======================================================================
// Animation.scss
// - Contains helpers for keyframes animation in css3
// - Only functionally with Sass 3.2.0 Alpha and Compass 0.13.alpha
// ======================================================================
@mixin animation-name($name) {
-webkit-animation-name: $name;
-moz-animation-name: $name;
-ms-animation-name: $name;
@tommymarshall
tommymarshall / DateFormat.php
Created Jun 3, 2012 — forked from cviebrock/DateFormat.php
DateFormat class for Laravel (or anyone)
View DateFormat.php
<?php
class DateFormat {
const DATE_SHORT = 'Y-m-d';
const DATE_LONG = 'F j, Y';
const DATETIME_SHORT = 'Y-m-d H:i';
const DATETIME_LONG = 'F j, Y, g:i a';
@tommymarshall
tommymarshall / uri.js
Created May 25, 2012 — forked from jlong/uri.js
URI Parsing with Javascript
View uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@tommymarshall
tommymarshall / gist:2661495
Created May 11, 2012 — forked from boucher/gist:1750375
Stripe PHP simple example
View gist:2661495
<?php
require 'path-to-Stripe.php';
if ($_POST) {
Stripe::setApiKey("YOUR-API-KEY");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
You can’t perform that action at this time.