Skip to content

Instantly share code, notes, and snippets.

View lukecav's full-sized avatar
Infinite data generation engine

Luke Cavanagh lukecav

Infinite data generation engine
View GitHub Profile
@lukecav
lukecav / webpack.js
Created November 24, 2015 19:35 — forked from sokra/webpack.js
// webpack is a module bundler
// This means webpack takes modules with dependencies
// and emits static assets representing those modules.
// dependencies can be written in CommonJs
var commonjs = require("./commonjs");
// or in AMD
define(["amd-module", "../file"], function(amdModule, file) {
// while previous constructs are sync
// this is async
<?php
/**
* Gravity Forms Easy Form Population
*
* Populate form fields with values from a previous form entry.
*
* @version 1.0
* @author Travis Lopes <tl@travislop.es>
* @license GPL-2.0+
* @link http://travislop.es/
@lukecav
lukecav / cf-hubspot.php
Created August 1, 2016 21:51 — forked from rothschild86/cf-hubspot.php
Caldera Forms to HubSpot CRM integration
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//required plugins: code snippets, caldera forms, caldera forms run action
add_action('consult_req_submitted', 'consult_req_submitted_sync_hubspot');
function consult_req_submitted_sync_hubspot( $data ){
$hubspot_api_key = 'ffffffff-27a0-4591-9b68-27d4bb31ed76';
$hubspot_list_id = '1'; //optional
@lukecav
lukecav / hubspot_form
Created August 1, 2016 21:52 — forked from joewils/hubspot_form
WordPress ShortCode for Embedding HubSpot Forms
<?php
// Usage: [hubspot_form form_id="1234-5678-90123-45676"]
// Inspiration: https://rschu.me/an-easy-way-to-embed-hubspot-forms-in-wordpress/
// API Documentation: http://developers.hubspot.com/docs/methods/forms/advanced_form_options
add_shortcode('hubspot_form', function($atts) {
extract(shortcode_atts(array(
'form_id' => null,
'redirect_url' => null
@lukecav
lukecav / functions.php
Created August 2, 2016 03:00 — forked from claudiosanches/functions.php
WooCommerce - Redirect to checkout after add product to the cart
<?php
/**
* Add to cart redirect to checkout.
*
* @param string $url
* @return string
*/
function my_wc_add_to_cart_redirect_to_checkout( $url ) {
return wc_get_checkout_url();
@lukecav
lukecav / js_google_fonts_async_ieshim
Created August 4, 2016 19:16 — forked from kosmiq/js_google_fonts_async_ieshim
An updated version of Thomas Bensmanns Load Google Fonts via JS (https://bensmann.no/google-webfonts-performance/) with a SHIM for IE9 and IE8.
WebFontConfig = {
google: { families: [ \'Ek+Mukta:200,800:latin\' ] }
};
var cb = function() {
var wf = document.createElement(\'script\');
wf.src = \'//ajax.googleapis.com/ajax/libs/webfont/1/webfont.js\';
wf.type = \'text/javascript\';
wf.async = \'true\';
var s = document.getElementsByTagName(\'script\')[0];
s.parentNode.insertBefore(wf, s);
@lukecav
lukecav / licence activation.php
Created August 8, 2016 17:14 — forked from mattradford/licence activation.php
ACF5 Pro licence activation. Could be adapted for any other plugin that requires a licence key, but doesn't yet support defining it in wp-config. Fires on theme activation.
// Place this in wp-config
define( 'ACF_5_KEY', 'yourkeyhere' );
// Set ACF 5 license key on theme activation. Stick in your functions.php or equivalent.
function auto_set_license_keys() {
if ( ! get_option( 'acf_pro_license' ) && defined( 'ACF_5_KEY' ) ) {
$save = array(
'key' => ACF_5_KEY,
@lukecav
lukecav / gravity_spinner_css
Created August 8, 2016 17:15 — forked from mattradford/gravity_spinner_css
Gravity Forms replacement spinner
.gform_ajax_spinner {
margin-left: 20px; /* give it some space from the Submit button */
border: 4px solid rgba(255, 255, 255, 0.3); /* match with border-left */
border-left: 4px solid gold;
animation: spinner 1.1s infinite linear;
border-radius: 50%;
width: 30px; /* match with height for a circle */
height: 30px;
}
@keyframes spinner {
@lukecav
lukecav / gravity_forms_filter_spinner.php
Created August 8, 2016 17:15 — forked from mattradford/gravity_forms_filter_spinner.php
Filters the Gravity Forms spinner and replaces it with a base64-encoded blank image
function gf_spinner_replace( $image_src, $form ) {
return 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; // relative to you theme images folder
}
add_filter( 'gform_ajax_spinner_url', 'gf_spinner_replace', 10, 2 );
@lukecav
lukecav / woocommerce-custom-order-action.php
Created August 9, 2016 16:07 — forked from JeroenSormani/woocommerce-custom-order-action.php
Add a new action to the order action drop down
add_action('woocommerce_order_actions', 'custom_wc_order_action', 10, 1 );
function custom_wc_order_action( $actions ) {
if ( is_array( $actions ) ) {
$actions['custom_action'] = __( 'My custom action' );
}
return $actions;
}