Skip to content

Instantly share code, notes, and snippets.

@jawinn
jawinn / add_download_count.php
Created Jul 27, 2018
Add download count to list of downloads (table) on the WooCommerce Customer's Order Email
View add_download_count.php
<?php
/**
* Add additional 'download-count' column to the table of downloads on the customer's order email.
* @param Array $columns Associative array of key "column_id" and value with the display name https://goo.gl/TDxPLE
*/
function add_order_email_dl_cols($columns) {
return array(
'download-product' => __( 'Product', 'woocommerce' ),
'download-expires' => __( 'Expires', 'woocommerce' ),
@jawinn
jawinn / fobi_states.txt
Last active Mar 27, 2018
Django FOBI - List of US States and Territories for Select Menu
View fobi_states.txt
AK, Alaska
AL, Alabama
AR, Arkansas
AS, American Samoa
AZ, Arizona
CA, California
CO, Colorado
CT, Connecticut
DC, District of Columbia
DE, Delaware
@jawinn
jawinn / appDelegate.m
Created May 24, 2017
Log font names, React Native
View appDelegate.m
// Add to application in appDelegate.m to log all font names as you would use them in CSS
for (NSString* family in [UIFont familyNames])
{
NSLog(@"%@", family);
for (NSString* name in [UIFont fontNamesForFamilyName: family])
{
NSLog(@" %@", name);
}
}
@jawinn
jawinn / mono_reset.cs
Last active Jul 14, 2016
MonoBehaviour.Reset() Example
View mono_reset.cs
private int _jointHealth;
public int startingJointHealth = 2;
// The setter here helps by making sure our health never goes below zero.
private int JointHealth {
get { return _jointHealth; }
set { _jointHealth = Mathf.Max(value, 0); }
}
void Reset(){
JointHealth = startingJointHealth;
}
@jawinn
jawinn / editor_gizmo.cs
Last active Jul 11, 2016
Draw Custom Editor Gizmo - Simple
View editor_gizmo.cs
void OnDrawGizmos (){
// In Editor
if (!Application.isPlaying){
// Draw custom gizmo
Gizmos.DrawIcon(transform.position, "spawn_gizmo.png", true);
// Draw yellow box at size of character, for easier placement in level
Gizmos.color = Color.yellow;
Gizmos.DrawWireCube(transform.position, new Vector3(0.8f, 2.0f, 0.8f));
}
}
@jawinn
jawinn / headers_tooltips.cs
Last active Jul 11, 2016
Headers and Tooltips in Unity (C#)
View headers_tooltips.cs
[Header("Movement and Speeds")]
[Tooltip("Player speeds, etc")]
public Movement movement;
[Tooltip("Determines maximum jog over time until timeToMaxJog (1.0 is max on curve)")]
public AnimationCurve rampToFullJog = new AnimationCurve(new Keyframe(0,0.1f),new Keyframe(1,1));
[Tooltip("Time in seconds before maximum jog speed is reached")]
public float timeToMaxJog = 2.0f;
@jawinn
jawinn / bootstrap_us_states_checkboxes.html
Created May 24, 2016
50 US States Checkboxes - for Bootstrap 3
View bootstrap_us_states_checkboxes.html
<div class="checkbox"><label><input name="regionStates[]" type="checkbox" value="AK">Alaska</label></div>
<div class="checkbox"><label><input name="regionStates[]" type="checkbox" value="AL">Alabama</label></div>
<div class="checkbox"><label><input name="regionStates[]" type="checkbox" value="AR">Arkansas</label></div>
<div class="checkbox"><label><input name="regionStates[]" type="checkbox" value="AZ">Arizona</label></div>
<div class="checkbox"><label><input name="regionStates[]" type="checkbox" value="CA">California</label></div>
<div class="checkbox"><label><input name="regionStates[]" type="checkbox" value="CO">Colorado</label></div>
<div class="checkbox"><label><input name="regionStates[]" type="checkbox" value="CT">Connecticut</label></div>
<div class="checkbox"><label><input name="regionStates[]" type="checkbox" value="DC">District Of Columbia</label></div>
<div class="checkbox"><label><input name="regionStates[]" type="checkbox" value="DE">Delaware</label></div>
<div class="checkbox"><label><input nam
@jawinn
jawinn / primary_category.php
Last active Apr 18, 2019
Display Primary Category (Yoast's WordPress SEO)
View primary_category.php
<?php
// SHOW YOAST PRIMARY CATEGORY, OR FIRST CATEGORY
$category = get_the_category();
$useCatLink = true;
// If post has a category assigned.
if ($category){
$category_display = '';
$category_link = '';
if ( class_exists('WPSEO_Primary_Term') )
@jawinn
jawinn / euro_country_codes.js
Last active Apr 21, 2016
Array of Countries that Use the Euro (ISO Alpha-2 Country Codes)
View euro_country_codes.js
// ===============================================================
// Array of countries using the Euro (ISO Alpha-2 country codes).
// *As of Jan, 2016.
// ===============================================================
var euro_users = {
// -- EU countries using the euro
'AT' : { name: 'Austria' },
'BE' : { name: 'Belgium' },
'CY' : { name: 'Cyprus' },
'EE' : { name: 'Estonia' },
@jawinn
jawinn / disable_yoast_xml_pinging.php
Last active Oct 9, 2018
Disable Yoast's Automatic XML Sitemap Pinging
View disable_yoast_xml_pinging.php
<?php
// DISABLE YOAST's AUTOMATIC PINGING OF XML SITEMAP
add_filter('wpseo_allow_xml_sitemap_ping', '__return_false');
?>
You can’t perform that action at this time.