Skip to content

Instantly share code, notes, and snippets.

View jawinn's full-sized avatar

Josh Winn jawinn

View GitHub Profile
@jawinn
jawinn / ondeviceready_ionic.js
Last active August 29, 2015 14:03
OnDeviceReady for Ionic Framework
// Snippet from app.js
.run(function($ionicPlatform, $rootScope) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
@jawinn
jawinn / http-vhosts.conf
Created August 7, 2014 03:06
WAMP - Additional www folders using httpd-vhosts.conf (www2, www3)
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
@jawinn
jawinn / functions_wp_woo.php
Last active August 29, 2015 14:05
WooCommerce Support to a Custom Theme
<?php
// ----------------------------------------------------
// WooCommerce Additions to functions.php in WordPress
// ----------------------------------------------------
// Theme support. Removes warning message in admin.
add_theme_support( 'woocommerce' );
// Removing tabs and replace with simple product description (removes "Reviews" etc)
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
@jawinn
jawinn / mailchimp_signup.html
Last active August 29, 2015 14:06
Add a Subscribe to MailChimp Newsletter Option on Your Contact Form - HTML
<input class="txt" title="First Name" name="firstName" type="text" />
<input class="txt" title="Last Name" name="lastName" type="text" />
<input name="emailUpdates" type="radio" value="Yes" /> Yes
<input checked="checked" name="emailUpdates" type="radio" value="No" /> No I would not like to receive email updates.
@jawinn
jawinn / subscribe_mailchimp.php
Last active August 29, 2015 14:06
Add a Subscribe to MailChimp Newsletter Option on Your Contact Form - PHP
<?php
// SUBSCRIBE TO MAILING LIST OPTION - ADD TO MAILCHIMP USING API
if ( $_POST['emailUpdates'] == 'Yes' )
{
// Include Mailchimp API class
require_once('MCAPI.class.php');
// Your API Key: http://admin.mailchimp.com/account/api/
$api = new MCAPI('YourAPIKeyHere');
@jawinn
jawinn / rate_app.js
Last active August 29, 2015 14:07
Rate app button, cross-platform app
// RATE APP LINK
$('#rate-app').on('click', function(e) {
// Find device platform using the plugin org.apache.cordova.device
var devicePlatform = device.platform;
// Check which platform
if (devicePlatform == "iOS") {
window.open('https://itunes.apple.com/us/app/YOUR-APP-SLUG-HERE/id000000000?mt=8&uo=4'); // or itms://
} else if (devicePlatform == "Android") {
window.open('market://details?id=com.YOUR.PACKAGENAME');
@jawinn
jawinn / featured_image_shopify_blog.liquid
Last active August 29, 2015 14:08
Featured Image for Shopify Blog
@jawinn
jawinn / viewlesstop.js
Last active August 29, 2015 14:08
View Less Top
$(".view-less-top").on("click", function() {
// find real "View Less" link and trigger a click on it
$closestTrigger = $(this).parent('h2').parent('.testimonial').find('.maxlist-more a');
$closestTrigger.trigger("click");
// set text the same, if in expanded state. else set to blank.
if ( $closestTrigger.hasClass('less') ) {
$(this).text( $closestTrigger.text() );
} else {
$(this).text('');
}
@jawinn
jawinn / smoothscroll.js
Last active August 29, 2015 14:15
Simple Smooth Scroll, jQuery
// SMOOTH SCROLL
$('#content .jump').on('click',function(e){
e.preventDefault();
$('html,body').animate({scrollTop: $( $.attr(this, 'href') ).offset().top }, 600);
});
@jawinn
jawinn / functions.php
Last active August 29, 2015 14:16
WooCommerce - Get the "Shipping Multiple Addresses" extension's shipping_notes field to appear in order details, and email.
// Change "Delivery Notes" to what text you'd like to appear in both locations.
// Include other fields in order details
function modify_order_details($order){
echo "<p><strong>Delivery Notes:</strong><br>", get_post_meta( $order->id, '_shipping_notes', true ), "</p>";
}
add_action( 'woocommerce_admin_order_data_after_shipping_address', 'modify_order_details', 10, 1 );
// Add extra fields to order emails.
// This part is via http://docs.woothemes.com/document/add-a-custom-field-in-an-order-to-the-emails/