View ko.extended.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is now managed officially here: https://github.com/codearachnid/knockout.extend | |
// custom binding attrIf which will check the value of a specific observable boolean before add or not the attributes | |
ko.bindingHandlers.attrIf = { | |
update: function (element, valueAccessor, allBindingsAccessor) { | |
var h = ko.utils.unwrapObservable(valueAccessor()); | |
var ifShow = ko.utils.unwrapObservable(h._if); | |
if (ifShow) { | |
ko.bindingHandlers.attr.update(element, valueAccessor, allBindingsAccessor); | |
} else { | |
for (var k in h) { |
View gist:9537604
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$attachment_ids = (array) $attachment_ids; | |
$wp_upload_dir = wp_upload_dir(); | |
$attachments = array(); | |
// THIS WILL NOT WORK > WPv3.8.1 | |
foreach( $attachment_ids as $attachment_id ){ | |
$attachment = wp_get_attachment_metadata( $attachment_id ); | |
if( !empty( $attachment['file'] ) ){ | |
$attachments[] = trailingslashit( $wp_upload_dir['basedir'] ) . $attachment['file']; |
View filter_widget_taxonomy_terms.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* For updates to this code please use the latest here: | |
* | |
* @link https://github.com/codearachnid/WPSE/blob/master/filter-by-author-widget-taxonomy-terms.php | |
*/ | |
add_filter( 'widget_tag_cloud_args', 'filter_categories_by_author' ); | |
add_filter( 'widget_categories_dropdown_args', 'filter_categories_by_author' ); |
View theme-unit-test-data.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
This is a WordPress eXtended RSS file generated by WordPress as an export of your site. | |
It contains information about your site's posts, pages, comments, categories, and other content. | |
You may use this file to transfer that content from one site to another. | |
This file is not intended to serve as a complete backup of your site. | |
To import this information into a WordPress site follow these steps: | |
1. Log in to that site as an administrator. | |
2. Go to Tools: Import in the WordPress admin panel. |
View custom_limit_gform_is_duplicate.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'gform_is_duplicate', 'custom_gform_is_duplicate', 10, 4 ); | |
function custom_gform_is_duplicate( $count, $form_id, $field, $value ){ | |
global $wpdb; | |
$lead_detail_table_name = GFFormsModel::get_lead_details_table_name(); | |
$lead_table_name = GFFormsModel::get_lead_table_name(); | |
$sql_comparison = "ld.value=%s"; | |
switch(RGFormsModel::get_input_type($field)){ |
View posts.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{assign_variable:my_weblog="default_site"} | |
{assign_variable:my_template_group="site"} | |
<?xml version="1.0" encoding="UTF-8" ?> | |
<!-- generator="WordPress/3.3.2" created="2012-06-25 23:09" --> | |
<rss version="2.0" | |
xmlns:excerpt="http://wordpress.org/export/1.1/excerpt/" | |
xmlns:content="http://purl.org/rss/1.0/modules/content/" | |
xmlns:wfw="http://wellformedweb.org/CommentAPI/" | |
xmlns:dc="http://purl.org/dc/elements/1.1/" | |
xmlns:wp="http://wordpress.org/export/1.1/" |
View gf_notification_debug.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Gravity Forms: Notification Attachments Debug | |
Plugin URI: http://codearachnid.github.io/gf-notification-attachment/ | |
Description: Debug the addon for Gravity Forms to add attachments to notification emails | |
Version: 1.0 | |
Author: Timothy Wood (@codearachnid) | |
Author URI: http://codearachnid.com |
View deviceBaseURL.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tempElement = document.createElement("a"); | |
tempElement.setAttribute("href", "."); | |
var deviceBaseURL = tempElement.href; |
View toRadians.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Convert degrees to radians | |
* @author Timothy Wood @codearachnid | |
* @link http://www.movable-type.co.uk/scripts/latlong.html | |
* @example | |
var latitude = 38.68551; | |
var longitude = -96.503906; | |
var latitude_radian = latitude.toRadians(); | |
var longitude_radian = longitude.toRadians(); |
OlderNewer