start new:
tmux
start new with session name:
tmux new -s myname
| /** | |
| * Polyfill for the vw, vh, vm units | |
| * Requires StyleFix from -prefix-free http://leaverou.github.com/prefixfree/ | |
| * @author Lea Verou | |
| */ | |
| (function() { | |
| if(!window.StyleFix) { | |
| return; |
| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
| <?php | |
| /* | |
| Usage: | |
| $frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL | |
| if ( !$frag->output() ) { // NOTE, testing for a return of false | |
| functions_that_do_stuff_live(); | |
| these_should_echo(); | |
| // IMPORTANT | |
| $frag->store(); | |
| // YOU CANNOT FORGET THIS. If you do, the site will break. |
| <?php for( $i = 0; $i < 9; $i++ ) : ?> | |
| <p><?php echo cycle('one', 'two', 'three') ?></p> | |
| <?php endfor; ?> |
| <?php | |
| /** | |
| * Hide editor on specific pages. | |
| * | |
| */ | |
| add_action( 'admin_init', 'hide_editor' ); | |
| function hide_editor() { | |
| // Get the Post ID. |
| DELETE o FROM `wp_posts` o | |
| LEFT OUTER JOIN `wp_posts` r | |
| ON o.post_parent = r.ID | |
| WHERE r.id IS null AND o.post_type = 'product_variation' |
| <?php | |
| /* | |
| * Plugin Name: Settings API Tabs Demo | |
| * Plugin URI: http://theme.fm/?p= | |
| * Description: This is a demo showing off usage of tabs with the WordPress Settings API | |
| * Version: 1.0 | |
| * Author: kovshenin | |
| * Author URI: http://theme.fm | |
| * License: GPL2 | |
| */ |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <templateSet group="WordPress"> | |
| <template name="aa" value="add_action( '$hook$', '$callback$' ); $END$" description="add_action" toReformat="false" toShortenFQNames="true"> | |
| <variable name="hook" expression="" defaultValue="" alwaysStopAt="true" /> | |
| <variable name="callback" expression="" defaultValue="" alwaysStopAt="true" /> | |
| <context> | |
| <option name="HTML_TEXT" value="false" /> | |
| <option name="HTML" value="false" /> | |
| <option name="XSL_TEXT" value="false" /> | |
| <option name="XML" value="false" /> |
| <?php | |
| //* Change the Add To Cart Link | |
| add_filter( 'woocommerce_loop_add_to_cart_link', 'sfws_add_product_link' ); | |
| function sfws_add_product_link( $link ) { | |
| global $product; | |
| $product_id = $product->id; | |
| $product_sku = $product->get_sku(); | |
| $link = '<a href="'.get_permalink().'" rel="nofollow" data-product_id="'.$product_id.'" data-product_sku="'.$product_sku.'" data-quantity="1" class="button add_to_cart_button product_type_variable">'.sfws_woocommerce_product_add_to_cart_text().'</a>'; | |
| return $link; | |
| } |