Skip to content

Instantly share code, notes, and snippets.

@alexdunae
alexdunae / wordpress_custom_post_gallery.php
Created March 31, 2011 23:55
Display a custom post type's media library inline on the WordPress edit page screen
<?php
define('MY_POST_TYPE', 'my');
define('MY_POST_SLUG', 'gallery');
function my_register_post_type () {
$args = array (
'label' => 'Gallery',
'supports' => array( 'title', 'excerpt' ),
'register_meta_box_cb' => 'my_meta_box_cb',
@tnorthcutt
tnorthcutt / gformscopyaddress.js
Created January 25, 2012 17:42
Autofill a set of fields (in a gravity form, in this case) based on a checkbox being checked.
jQuery(document).ready(function($) {
$('input#choice_13_1').click(function() {
if($(this).is(':checked')) {
$('#input_2_12_1').val($('#input_2_2_1').val());
$('#input_2_12_2').val($('#input_2_2_2').val());
$('#input_2_12_3').val($('#input_2_2_3').val());
$('#input_2_12_4').val($('#input_2_2_4').val());
$('#input_2_12_5').val($('#input_2_2_5').val());
};
});
@charlesdaniel
charlesdaniel / basic_auth_nodejs_test.js
Created January 27, 2012 02:53
Example of HTTP Basic Auth in NodeJS
var http = require('http');
var server = http.createServer(function(req, res) {
// console.log(req); // debug dump the request
// If they pass in a basic auth credential it'll be in a header called "Authorization" (note NodeJS lowercases the names of headers in its request object)
var auth = req.headers['authorization']; // auth is in base64(username:password) so we need to decode the base64
console.log("Authorization Header is: ", auth);
@kloon
kloon / functions.php
Last active December 16, 2015 13:19
WooCommerce eWAY Shared Payments Page Title
<?php
// Page Title, displayed as the title of the browser
add_filter( 'eway_shared_page_tite', 'woocommerce_eway_page_title' );
function woocommerce_eway_page_title() {
return __( 'My New Page Title', 'woocommerce' );
}
// Company Name, the name of the company the customer is buying from
add_filter( 'eway_shared_company_name', 'woocommerce_eway_company_name' );
@Mantish
Mantish / shipping-awd.php
Last active November 24, 2023 21:55
AWD Weight/CountryShipping plugin modified to make it state based instead of country based. It has some minor tweaks as well
<?php
/**
* Plugin Name: AWD Weight/State Shipping
* Plugin URI: http://www.andyswebdesign.ie/blog/free-woocommerce-weight-and-country-based-shipping-extension-plugin/
* Description: Weight and State based shipping method for Woocommerce.
* Version: 1.0.1
* Author: Andy_P (modified by Mantish to make it state based)
/* Copyright 2012 andyswebdesign.ie
This program is free software; you can redistribute it and/or modify
@leobossmann
leobossmann / bulk import shipping rates
Created July 23, 2013 20:36
Bulk create/delete shipping rates in the Shopify backend. Go to Settings/Shipping and paste it into Javascript console. WARNING: This is a proof of concept, use with extreme caution and only if you know what you're doing, you will have to customize this to fit your needs. Again, just a proof of concept, worked for me, might not work for you. Ong…
function make_shipping_rates(id, low, mid, high) {
$.post('/admin/price_based_shipping_rates.json', {
price_based_shipping_rate: {
country_id: id,
min_order_subtotal: "0",
max_order_subtotal: "500",
name: "DHL Premiumversand",
offsets: [],
price: low
}
@akrug23
akrug23 / html
Created September 20, 2013 00:04
US States Dropdown
<form action="./" method="GET">
<select name="state">
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<!--
CSS STYLES:
body { padding-top:30px; }
.form-control { margin-bottom: 10px; }
-->
<!-- User Sign-up Form -->
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-4 well well-sm">
@bMinaise
bMinaise / bs3-login-form.html
Created November 6, 2013 02:20
Bootstrap 3 - Login Form Example From: http://bootsnipp.com
<div class="container">
<div class="row">
<div class="col-sm-6 col-md-4 col-md-offset-4">
<h1 class="text-center login-title">Sign in to continue to Bootsnipp</h1>
<div class="account-wall">
<img class="profile-img" src="https://lh5.googleusercontent.com/-b0-k99FZlyE/AAAAAAAAAAI/AAAAAAAAAAA/eu7opA4byxI/photo.jpg?sz=120"
alt="">
<form class="form-signin">
<input type="text" class="form-control" placeholder="Email" required autofocus>
<input type="password" class="form-control" placeholder="Password" required>
@noeldiaz
noeldiaz / gist:0f9a2583a41579878764
Created July 18, 2014 15:56
Homestead 32-bit Version
## Making a 32 bit version of Homestead
# Clone the settler repository to a directory
git clone https://github.com/laravel/settler.git Ubuntu32
# In that directory edit the file called "Vagrantfile" to use a ubuntu 32 box instead of the 64 bit one
change this line:
config.vm.box = "ubuntu/trusty64"