Skip to content

Instantly share code, notes, and snippets.

@gcorne
gcorne / Calypso
Created May 19, 2014 21:46 — forked from mtias/Calypso
App
Layout
Toolbar
Section
Sidebar
Filters
Module.Manage -- (index == Sites)
Sites
Posts
diff --git src/wp-includes/js/tinymce/plugins/paste/plugin.js src/wp-includes/js/tinymce/plugins/paste/plugin.js
index 45a6e38..92b5411 100644
--- src/wp-includes/js/tinymce/plugins/paste/plugin.js
+++ src/wp-includes/js/tinymce/plugins/paste/plugin.js
@@ -313,6 +313,8 @@ define("tinymce/pasteplugin/Clipboard", [
var rects = lastRng.getClientRects();
if (rects.length) {
top = scrollTop + (rects[0].top - dom.getPos(body).y);
+ } else if ( lastRng.startContainer.offsetTop ) {
+ top = scrollTop + (lastRng.startContainer.offsetTop - dom.getPos(body).y);
<?php
$init = memory_get_usage();
$test_me = array();
$test_me['name'] = 'Joseph Scott';
$test_me['city'] = 'Sandy';
$test_me['state'] = 'Utah';
echo "MEM: " . ( memory_get_usage() - $init ) . "\n";
<?php
class Test {
public $name;
public $city;
public $state;
public function __construct( $name, $city, $state ) {
$this->name = $name;
$this->city = $city;
@gcorne
gcorne / jetpack-tweaks.php
Created December 10, 2012 18:01
Hide Jetpack menu from Subscribers
<?php
function jetpack_hide_from_subscribers() {
if ( ! current_user_can('edit_posts') ) {
remove_menu_page( 'jetpack' );
}
}
add_action('jetpack_admin_menu', 'jetpack_hide_from_subscribers');
@gcorne
gcorne / wptest-runner.php
Created June 28, 2012 19:59
WP test suite runner
function wptest_run_tests($classes, $classnames = array(), $filter = null ) {
$suite = new PHPUnit_Framework_TestSuite();
if ( ! is_array($classnames) ) // For strings, Accept a comma separated list, or a space separated list.
$classnames = preg_split('![,\s]+!', $classnames);
$classnames = array_map('strtolower', $classnames);
$classnames = array_filter($classnames); //strip out any empty items
foreach ( $classes as $testcase ) {