Skip to content

Instantly share code, notes, and snippets.

@marius7383
marius7383 / Yii2 MessageController Mark Unused Feature
Created June 1, 2015 11:42
Patch that shows how an additional config parameter "markUnused" could be introduced into Yii2 MessageController in order to prevent appending and prepending @@ strings to (potentially) unused messages.
diff --git a/vendor/yiisoft/yii2/console/controllers/MessageController.php b/vendor/yiisoft/yii2/console/controllers/MessageController.php
--- a/vendor/yiisoft/yii2/console/controllers/MessageController.php
+++ b/vendor/yiisoft/yii2/console/controllers/MessageController.php
@@ -89,6 +89,7 @@ class MessageController extends Controller
'translator' => 'Yii::t',
'overwrite' => false,
'removeUnused' => false,
+ 'markUnused' => false,
'sort' => false,
'format' => 'php',
@marius7383
marius7383 / ko-money.js
Last active April 26, 2016 10:33 — forked from jakiestfu/ko-money.js
Used to display and read formatted money via Knockout binding
(function () {
// Credit for escapeRegExp goes to MDN
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Using_Special_Characters
function escapeRegExp(str) {
return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
}
// Credit for replaceAll goes to Sean Bright
// http://stackoverflow.com/a/1144788/2919694