This file contains hidden or 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
| set api_key to "xxxxxxxxx" | |
| set domain to "yourdomain.net" | |
| set the longURL to (the clipboard as string) | |
| if ((characters 1 through 4 of longURL as string) is not "http") then | |
| return "Not a valid URL" | |
| else | |
| set shellScript to ("curl --url \"http://" & domain & "/-/?api=" & api_key & "&url=" & longURL & "\"") | |
| set shortURL to (do shell script shellScript) |
This file contains hidden or 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
| from django.http import HttpResponse | |
| from datetime import datetime | |
| def export_as_vcard(modeladmin, request, queryset): | |
| """ | |
| Export vCard admin action | |
| Update source to match your model | |
| Example usage: |
This file contains hidden or 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
| function in_custom_category_slug($post_id, $taxonomy, $category_slug){ | |
| $categories = get_the_terms($post_id, $taxonomy); | |
| foreach ($categories as $category) { | |
| if($category->slug == $category_slug){ | |
| return true; | |
| } | |
| } | |
| return false; | |
| } |
This file contains hidden or 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 strQueryString=""; | |
| var hasQueryString = document.URL.indexOf('?'); | |
| if (hasQueryString != -1){ | |
| strQueryString = document.URL.substring(hasQueryString, document.URL.length); | |
| } | |
| if(strQueryString != ""){ | |
| iframe = document.getElementById("IFRAME_ID_HERE"); | |
| currentSrc = iframe.getAttribute('src'); |
This file contains hidden or 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
| // Requires Content Type with image field with multiple images as described here: http://drupal.stackexchange.com/a/5901 | |
| // Title is output as caption if there is title text | |
| // Image size is determined by custom image style in Drupal admin named "gallery_thumb" | |
| <?php | |
| $gallery_images = $node->field_gallery_image['und']; | |
| for($i = 0; $i < count($gallery_images); $i++) { | |
| $image = $gallery_images[$i]; | |
| $output = '<a href="' . file_create_url($image['uri']) . '">'; | |
| $output .= '<img src="' . image_style_url("gallery_thumb", $image['uri']) . '">'; |
This file contains hidden or 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 | |
| // 1. Put all timeline entries into array | |
| $timeline_entries = array(); | |
| // Retrieve entries sorted by date | |
| $query = new WP_Query( array('post_type' => 'timeline-entry', 'posts_per_page' => -1, 'order' => 'ASC' , 'orderby' => 'meta_value', 'meta_key' => 'date' )); | |
| if ($query->have_posts()): | |
| while ( $query->have_posts() ): | |
| $query->the_post(); | |
| $date = get_custom_field('date'); |
This file contains hidden or 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
| <!-- formatting fun #1: tables! --> | |
| <!-- use whitespace to mimic the layout you want. leave off optional end tags for readability --> | |
| <table> | |
| <caption>Selector engines, parse direction</caption> | |
| <thead> | |
| <tr><th>Left to right <th>Right to left | |
| <tbody> | |
| <tr><td>Mootools <td>Sizzle |
This file contains hidden or 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
| <? | |
| function sidebarbrief_func($atts) { | |
| extract(shortcode_atts(array('foo' => 'something'), $atts)); | |
| global $more; // Declare global $more (before the loop). | |
| $posts_query = new WP_Query( array( 'post_type' => array('brief'), 'tag_id' => 16, posts_per_page => 1 ) ); | |
| $output = '<h1>News in Brief</h1>'; | |
| while ( $posts_query->have_posts() ) : $posts_query->the_post(); | |
| $more = 0; // Set (inside the loop) to display content above the more tag. | |
| $output .= '<div class="brief">'; |
This file contains hidden or 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
| function unhide_kitchensink( $args ) { | |
| $args['wordpress_adv_hidden'] = false; | |
| return $args; | |
| } | |
| add_filter( 'tiny_mce_before_init', 'unhide_kitchensink' ); |