Skip to content

Instantly share code, notes, and snippets.

View ocean90's full-sized avatar
🌊
Surfing the open source wave

Dominik Schilling ocean90

🌊
Surfing the open source wave
View GitHub Profile
VM794:1 Uncaught SyntaxError: Unexpected token <
(anonymous function) @ jquery.js?ver=1.12.0:2
n.extend.globalEval @ jquery.js?ver=1.12.0:2
Ha @ jquery.js?ver=1.12.0:3
n.fn.extend.replaceWith @ jquery.js?ver=1.12.0:3
wp.customize.selectiveRefresh.self.Partial.api.Class.extend.renderContent @ customize-selective-refresh.js?ver=4.5-alpha-35776-src-1455797107:295
wp.customize.navMenusPreview.wp.customize.MenusCustomizerPreview.self.NavMenuInstancePartial.api.selectiveRefresh.Partial.extend.renderContent @ customize-preview-nav-menus.js?ver=4.5-alpha-35776-src-1455797107:118
(anonymous function) @ customize-selective-refresh.js?ver=4.5-alpha-35776-src-1455797107:225
_.each._.forEach @ underscore.js?ver=1.8.3:153
<?php
$data = file_get_contents( 'https://raw.githubusercontent.com/unicode-cldr/cldr-core/master/supplemental/territoryInfo.json' );
$data = json_decode( $data );
$country2langs = [];
foreach ( $data->supplemental->territoryInfo as $country => $data ) {
if ( ! isset( $data->languagePopulation ) ) {
continue;
@ocean90
ocean90 / gist:f29adb0bb977e53943bc
Created November 7, 2015 11:18
Node Modules for WordPress Build
├─┬ autoprefixer@6.0.3
│ ├── browserslist@1.0.1
│ ├── caniuse-db@1.0.30000359
│ ├── num2fraction@1.2.2
│ └─┬ postcss@5.0.10
│ ├── js-base64@2.1.9
│ ├── source-map@0.5.3
│ └─┬ supports-color@3.1.2
│ └── has-flag@1.0.0
├─┬ grunt@0.4.5
You should really fix these slow tests (>250ms)...
1. 1601ms to run Tests_Basic:test_readme
2. 1384ms to run Tests_Canonical:test with data set #0
3. 1338ms to run Tests_WP_Site_Icon:test_insert_cropped_attachment
4. 1142ms to run Tests_XMLRPC_wp_uploadFile:test_valid_attachment
5. 1118ms to run Tests_Term_Cache:test_hierachy_invalidation
6. 1000ms to run Tests_Theme:test_get_themes_contents
7. 940ms to run Tests_XMLRPC_wp_newPost:test_post_format
8. 938ms to run Tests_WP_Site_Icon:test_create_attachment_object
9. 914ms to run Tests_XMLRPC_wp_getOptions:test_option_values_admin
@ocean90
ocean90 / debug-mail.php
Last active August 29, 2015 14:24
Saves outgoing mails in a post type, drop it into wp-content/mu-plugins.
<?php
/**
* Plugin Name: Debug Mails
* Description: Saves outgoing mails in a post type.
* Author: Dominik Schilling (ocean90)
*/
function ds_register_cpt_mail_debug() {
register_post_type( 'mail-debug', array(
'label' => 'Mails',
<?php
function wporg_forums_add_administrator_role( $bbp_roles ) {
$bbp_roles['wporg_forums_admin'] = array(
'name' => __( 'Forums Administrator', 'wporg' ),
'capabilities' => bbp_get_caps_for_role( 'wporg_forums_admin' )
);
return $bbp_roles;
}
add_filter( 'bbp_get_dynamic_roles', 'wporg_forums_add_administrator_role', 1 );
@ocean90
ocean90 / Default (OSX).sublime-keymap
Created December 14, 2014 14:56
Sublime Text 3 Config
[
{ "keys": ["ctrl+super+l"], "command": "sublimelinter_lint" },
{ "keys": ["ctrl+super+e"], "command": "sublimelinter_goto_error", "args": {"direction": "next"} },
{ "keys": ["ctrl+super+shift+e"], "command": "sublimelinter_goto_error", "args": {"direction": "previous"} },
{ "keys": ["ctrl+super+b"], "command": "sublimelinter_show_all_errors" },
{ "keys": ["super+ctrl+a"], "command": "alignment" },
// swap the keybindings for paste and paste_and_indent
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" }
]
@ocean90
ocean90 / gist:59cae91cf950ebd6c33c
Last active August 29, 2015 14:08
Customizer Tickets for 4.1

4.1 Enhancements

Query

  • #21627 Filter for custom-background CSS selector [punt, use case is rare]
  • #29949 Customizer collapsed mode is barely usable [punt, mobile first]
  • #28650 Allow Customizer elements (controls, sections, and panels) to be deep-linked [needs-patch, margin bug]
  • #28542 Navigating within Customizer preview should update parent document title [commit 28542.2.diff]
  • #28504 Icons for Customizer Sections [punt, mobile first]
  • #28032 Headers, Backgrounds, and Widgets in the Customizer are not discoverable from their separate admin screens.
@ocean90
ocean90 / 29026.patch
Last active August 29, 2015 14:04
wp.media.view.Label
Index: src/wp-includes/js/media-views.js
===================================================================
--- src/wp-includes/js/media-views.js (revision 29312)
+++ src/wp-includes/js/media-views.js (working copy)
@@ -5508,6 +5508,8 @@
this.createFilters();
_.extend( this.filters, this.options.filters );
+ this.createLabel();
+
@ocean90
ocean90 / db.php
Created June 15, 2013 14:33
When you have a project which still runs on WordPress 3.3 (Oh boy..) and want to use the $wpdb::delete() method you can easily extend the wpdb class by dropping this db.php file into WP_CONTENT_DIR. Thanks @toscho for the hint.
<?php
/**
* This class provides the $wpdb::delete() method which was introduced in WordPress 3.4.
*
* @link https://core.trac.wordpress.org/ticket/18948
*/
class DS_wpdb extends wpdb {
/**
* Delete a row in the table