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
request_token_base_string = 'POST&' + CGI.escape("#{Pazienti2::Application::BLOG_URL}oauth1/request") + "&" + request_token_url.query | |
hmac = OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), params[:oauth_consumer_secret].encode("ASCII") + '&' + '', request_token_base_string.encode("ASCII")) | |
signature = Base64.encode64(hmac).chomp | |
request_token_params[:oauth_signature] = signature |
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
(function($){ | |
$(document).ready(function(){ | |
$('a').click(function(e){ | |
var el = $(this).prev('input[type="checkbox"]'); | |
if(el.is(':checked')){ | |
el.prop('checked',false); | |
} | |
$.ajax({ | |
url : 'http://localhost/wordpress/wp-admin/admin-ajax.php', | |
type : 'POST', |
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 | |
public function posts_by_day() { | |
global $json_api, $post; | |
$days = array(); | |
add_filter( 'posts_where', array( $this, 'filter_where' ) ); | |
$query = new WP_Query( array( | |
'post_type' => array('post', 'imported_content' ), | |
'posts_per_page' => -1, | |
) ); | |
if( $query->have_posts() ): while( $query->have_posts() ): $query->the_post(); |
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 | |
public function posts_by_day() { | |
global $json_api, $post; | |
$days = array(); | |
$query = new WP_Query( array( | |
'post_type' => array( ), | |
'posts_per_page' => -1, | |
) ); | |
if( $query->have_posts() ): while( $query->have_posts() ): $query->the_post(); | |
if( !isset( $days[ get_the_time( 'Y-m-d' ) ] ) ) |
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
<snippet> | |
<content><![CDATA[ | |
<script> | |
jQuery(function(\$) { | |
${1://put all your jQuery goodness in here.} | |
}); | |
</script> | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>jqready</tabTrigger> |
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 | |
function avada_kedavra() { | |
if(round(rand())){ | |
return 'Rebound!!!! Dodge?'; | |
} | |
die('Avada Kedavra!!!!'); | |
} |
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 a simple way to keep track of the number of post views, paste this snippet into the functions.php, and then follow steps 1 and 2. | |
*/ | |
function getPostViews($postID){ | |
$count_key = 'post_views_count'; | |
$count = get_post_meta($postID, $count_key, true); | |
if($count=='' || $count==0){ | |
delete_post_meta($postID, $count_key); |
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_action( 'init', 'make_sopa_blackout' ); | |
function make_sopa_blackout() { | |
if ( ! is_admin() ) { | |
$current_time = current_time( 'timestamp' ); | |
$start_time = strtotime( '2012/01/17 8:00' ); | |
$end_time = strtotime( '2012/01/17 20:00' ); | |
if( $current_time >= $start_time && $current_time <= $end_time ) { | |
wp_redirect( 'http://oreilly.com/make-blackout.html', 503 ); |
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 | |
//error_reporting(E_ALL); | |
if ( function_exists( 'wpcom_is_vip' ) && wpcom_is_vip() ) { | |
// Load the WordPress.com dependent helper file | |
wpcom_vip_load_helper_wpcom(); // vip-helper-wpcom.php | |
} else { | |
// These two plugins are automatically loaded on WordPress.com | |
require_once( WP_CONTENT_DIR . '/themes/vip/plugins/vip-do-not-include-on-wpcom/vip-local-development-helper/vip-local-development-helper.php' ); | |
require_once( WP_CONTENT_DIR . '/themes/vip/plugins/vip-do-not-include-on-wpcom/vip-powered-wpcom/vip-powered-wpcom.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
function js_add_review($content) { | |
global $post; | |
$content = $content.js_ratings_box(); | |
$guide = get_post_custom_values('MakeProjectsGuideNumber'); | |
if (isset($guide[0])) { | |
$content .= js_make_project($guide); | |
} | |
return $content; | |
} |
NewerOlder