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( 'jetpack_can_make_outbound_https', '__return_true', 99999 ); |
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
col2num = lambda col: reduce(lambda x, y: x*26 + y, [ord(c.upper()) - ord('A') + 1 for c in col])-1 |
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() { | |
var file_frame; // variable for the wp.media file_frame | |
// attach a click event (or whatever you want) to some element on your page | |
$( '#frontend-button' ).on( 'click', function( event ) { | |
event.preventDefault(); | |
// if the file_frame has already been created, just reuse it |
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: Front-end Media Example | |
* Plugin URI: http://derekspringer.wordpress.com | |
* Description: An example of adding the media loader on the front-end. | |
* Version: 0.1 | |
* Author: Derek Springer | |
* Author URI: http://derekspringer.wordpress.com | |
* License: GPL-2.0+ |
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
<div class="beer-recipe"> | |
<div class="beer-details"> | |
<h3>Recipe Details</h3> | |
<table> | |
<thead> | |
<tr> | |
<th>Batch Size</th> | |
<th>Boil Time</th> | |
<th>IBU</th> | |
<th>SRM</th> |
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
add_action( 'wp_head', 'openid_delegate' ); | |
function openid_delegate() { | |
echo <<<HTML | |
<!-- OpenID Delegation --> | |
<link rel="openid.server" href="https://yoursite.wordpress.com/?openidserver=1"> | |
<link rel="openid.delegate" href="https://yoursite.wordpress.com/"> | |
HTML; | |
} |
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
#!/usr/bin/env bash | |
dir="." | |
if [ $1 ]; then dir=$1; fi | |
bad_funcs="exec system passthru shell_exec escapeshellarg escapeshellcmd proc_close proc_open dl popen show_source ini_set" | |
for func in $bad_funcs | |
do | |
grep -R --include=*.php $func $dir | |
done |
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 | |
class Some_WP_Plugin { | |
/** | |
* Init everything here | |
*/ | |
public function __construct() { | |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); | |
add_filter( 'ajax_query_attachments_args', array( $this, 'filter_media' ) ); |
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
@import "icons/*.png"; | |
.foo { | |
font-size: 20px; | |
color: red; | |
&:before { | |
@include icons-sprite(wrench); | |
width: 32px; | |
height: 32px; |
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
# FizzBuzz in one line (minus this comment) | |
print '\n'.join(['%d %s%s' % (i, 'Fizz'*(i%3==0), 'Buzz'*(i%5==0)) for i in xrange(101)]) |
NewerOlder