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/ruby | |
# | |
# The MIT License (MIT) | |
# Copyright (c) 2013 Mark Jaquith | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
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_filter( 'tiny_mce_before_init', 'my_mce_init', 20 ); | |
function my_mce_init( $init ) { | |
if ( current_user_can('unfiltered_html') ) { | |
if ( ! empty( $init['extended_valid_elements'] ) ) { | |
$init['extended_valid_elements'] .= ','; | |
} else { | |
$init['extended_valid_elements'] = ''; | |
} | |
$init['extended_valid_elements'] .= 'img[id|accesskey|class|dir|lang|style|tabindex|title|contenteditable|contextmenu|draggable|dropzone|hidden|spellcheck|translate|src|alt=|usemap|ismap|width|height|name|longdesc|align|border|hspace|vspace|crossorigin|onclick|ondblclick|onmousedown|onmouseenter|onmouseleave|onmousemove|onmouseover|onmouseout|onmouseup|onkeydown|onkeypress|onkeyup]'; |
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 set_attribute( element, setFrom, setTo ) { | |
var val = element.val(); | |
from = 'type=\"' + setFrom + '\"', | |
to = 'type=\"' + setTo + '\"'; | |
// Workaround for element.attr('type', 'password'); doesn't work in ie8 | |
element | |
.replaceWith( | |
element = $( element.wrap( '<label></label>' ) | |
.parent('label') |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
var uuid = require('node-uuid'), // npm install node-uuid | |
crypto = require('crypto'); | |
var UUID_NUM = 1000000; | |
var uuid_table = {}; | |
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 | |
// How many revisions should be created? | |
$num_of_revisions = 900; | |
// Demo content | |
$content = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. | |
Lorem ipsum dolor sit amet, minim |
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( 'deprecated_constructor_trigger_error', '__return_false' ); | |
add_filter( 'deprecated_function_trigger_error', '__return_false' ); | |
add_filter( 'deprecated_file_trigger_error', '__return_false' ); | |
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 PrintTrace() { | |
$trace = debug_backtrace(); | |
echo '<pre>'; | |
$sb = array(); | |
foreach($trace as $item) { | |
if(isset($item['file'])) { | |
$sb[] = htmlspecialchars("$item[file]:$item[line]"); | |
} else { | |
$sb[] = htmlspecialchars("$item[class]:$item[function]"); | |
} |
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
// Create a new post | |
var post = new wp.api.models.Posts({ title:'new test' } ); | |
post.save(); | |
// Get a collection of the post's categories | |
var postCategories = post.getCategories(); | |
// The new post has an single Category: Uncategorized | |
postCategories.at( 0 ).get('name'); | |
// response -> "Uncategorized" |
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
jQuery( document ).on( 'click', 'div.attachment-preview', function( e ) { | |
console.log( 'Image clicked', e ); | |
// Do ajax stuff here... | |
} ); |
OlderNewer