'atom-text-editor':
'ctrl-shift-a': 'jaceklaskowski:copy-file-name'
path = require 'path'
atom.commands.add 'atom-text-editor', 'jaceklaskowski:copy-file-name', ->
<?php | |
/* | |
* dl-file.php | |
* | |
* Protect uploaded files with login. | |
* | |
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in | |
* | |
* @author hakre <http://hakre.wordpress.com/> | |
* @license GPL-3.0+ |
<?php | |
// Add save percent next to sale item prices. | |
add_filter( 'woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2 ); | |
function woocommerce_custom_sales_price( $price, $product ) { | |
$percentage = round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100 ); | |
return $price . sprintf( __(' Save %s', 'woocommerce' ), $percentage . '%' ); | |
} | |
?> |
<?php | |
/* | |
* Google Font Importer | |
*/ | |
$fonts = "https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyCpfnm5kVng8hhP_jnAnnTXVP7MEUM89-k"; | |
$fonts = file_get_contents($fonts, 0, null, null); | |
$fp = fopen('fonts.txt', 'w'); |
<?php | |
/** | |
* Plugin Name: WooCommerce Settings Tab Demo | |
* Plugin URI: https://gist.github.com/BFTrick/b5e3afa6f4f83ba2e54a | |
* Description: A plugin demonstrating how to add a WooCommerce settings tab. | |
* Author: Patrick Rauland | |
* Author URI: http://speakinginbytes.com/ | |
* Version: 1.0 | |
* | |
* This program is free software: you can redistribute it and/or modify |
<?php | |
/** | |
* Insert an attachment from a URL address. | |
* | |
* @param string $url The URL address. | |
* @param int|null $parent_post_id The parent post ID (Optional). | |
* @return int|false The attachment ID on success. False on failure. | |
*/ | |
function wp_insert_attachment_from_url( $url, $parent_post_id = null ) { |
var mediaJSON = { "categories" : [ { "name" : "Movies", | |
"videos" : [ | |
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org", | |
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ], | |
"subtitle" : "By Blender Foundation", | |
"thumb" : "images/BigBuckBunny.jpg", | |
"title" : "Big Buck Bunny" | |
}, | |
{ "description" : "The first Blender Open Movie from 2006", | |
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ], |
<?php | |
/* Redirect user after check out */ | |
add_action( 'template_redirect', 'jay_custom_redirect_after_purchase' ); | |
function jay_custom_redirect_after_purchase() { | |
global $wp; | |
if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) { | |
wp_redirect( 'http://www.yoururl.com/your-page/' ); | |
exit; |
/* | |
##Device = Desktops | |
##Screen = 1281px to higher resolution desktops | |
*/ | |
@media (min-width: 1281px) { | |
/* CSS */ | |
<?php | |
/** | |
* Hide shipping rates when free shipping is available. | |
* Updated to support WooCommerce 2.6 Shipping Zones. | |
* | |
* @param array $rates Array of rates found for the package. | |
* @return array | |
*/ | |
function my_hide_shipping_when_free_is_available( $rates ) { | |
$free = array(); |