Skip to content

Instantly share code, notes, and snippets.

@ockham
ockham / hooked-blocks-with-attributes.php
Last active April 9, 2024 13:16
Hooked Blocks with Attributes
<?php
/**
* Plugin Name: Block Hooks with Attributes
* Description: Allow insertion of hooked blocks of the same type that are only differentiated by their attributes.
* Version: 0.1.0
* Requires at least: 6.5
*/
defined( 'ABSPATH' ) || exit;
@ockham
ockham / single-tree-render-codemod.js
Last active March 27, 2017 21:33
single-tree-render-codemod.js
export default function transformer(file, api) {
const j = api.jscodeshift;
const root = j(file.source);
function addNextMiddleware(path) {
if (path.value.params.length !== 1) {
// More than just a context arg, possibly not a middleware
return path.value;
}
let ret = path.value;
Only in before: accept-invite.5891c44edb7b0d306cca.js
Only in before: accept-invite.5891c44edb7b0d306cca.m.js
Only in master: accept-invite.65bc8441e56b2182d9ac.js
Only in master: accept-invite.65bc8441e56b2182d9ac.m.js
Only in before: account-recovery.15fa14e81cb9603d1f0b.js
Only in before: account-recovery.15fa14e81cb9603d1f0b.m.js
Only in master: account-recovery.573d9fe4771df0cd7db2.js
Only in master: account-recovery.573d9fe4771df0cd7db2.m.js
Only in master: account.044f5ef3b471f866133a.js
Only in master: account.044f5ef3b471f866133a.m.js
diff --git a/server/pages/index.js b/server/pages/index.js
index 4021343..1a88707 100644
--- a/server/pages/index.js
+++ b/server/pages/index.js
@@ -394,11 +394,9 @@ module.exports = function() {
app.get( '/mailing-lists/unsubscribe', setUpRoute, serverRender );
}
- if ( config.isEnabled( 'reader/discover' ) && config( 'env' ) !== 'development' ) {
- app.get( '/discover', function( req, res, next ) {
commit 08a78d6db7955cf469063d0bc50a5550fa02b0df
Author: Bernhard Reiter <ockham@raz.or.at>
Date: Mon May 30 13:50:35 2016 +0200
Iso-routing: Pass next() to applyMiddlewares()
This way, it will be called in the right order even if there is an async invocation in the mw chain.
diff --git a/server/isomorphic-routing/index.js b/server/isomorphic-routing/index.js
index 3a35066..271c1d2 100644
diff --git a/server/isomorphic-routing/index.js b/server/isomorphic-routing/index.js
index e6e454c..9410c0c 100644
--- a/server/isomorphic-routing/index.js
+++ b/server/isomorphic-routing/index.js
@@ -1,7 +1,6 @@
/**
* Internal dependencies
*/
-import i18n from 'lib/mixins/i18n';
import { serverRender } from 'render';
diff --git a/client/layout/logged-out-design.jsx b/client/layout/logged-out-design.jsx
index bbc86cf..1e55722 100644
--- a/client/layout/logged-out-design.jsx
+++ b/client/layout/logged-out-design.jsx
@@ -4,6 +4,8 @@
* External dependencies
*/
import React from 'react';
+import classNames from 'classnames';
+import { connect } from 'react-redux';
diff --git a/server/pages/index.jade b/server/pages/index.jade
index f26653b..bab4888 100644
--- a/server/pages/index.jade
+++ b/server/pages/index.jade
@@ -46,8 +46,11 @@ html(lang=lang, dir=isRTL ? 'rtl' : 'ltr', class=isFluidWidth ? 'is-fluid-width'
link(rel='stylesheet', href=urls['style.css'])
body(class=isRTL ? 'rtl' : '')
- #wpcom.wpcom-site
- .wpcom-site__logo.noticon.noticon-wordpress
@ockham
ockham / ForbiddenPHPFunctionsCheck.php
Created December 10, 2014 21:22
ForbiddenPHPFunctionsCheck.php
<?php
/**
* Checks for the usage of forbidden PHP functions.
*/
class ForbiddenPHPFunctionsCheck extends CodeCheck {
protected static $forbidden_php_functions = array(
'popen',
'proc_open',
@ockham
ockham / gist:09845e12d48d0d7bc258
Created December 3, 2014 16:50
An example PhpParser\Node
[2] => PhpParser\Node\Expr\FuncCall Object
(
[subNodes:protected] => Array
(
[name] => PhpParser\Node\Name Object
(
[subNodes:protected] => Array
(
[parts] => Array
(