Skip to content

Instantly share code, notes, and snippets.

View mikl's full-sized avatar

Mikkel Høgh mikl

View GitHub Profile
@mikl
mikl / setISODate.js
Created November 28, 2011 22:20
This illustrates pretty well why Date is my least favorite part of JavaScript…
if (typeof Date.prototype.setISODate !== 'function') {
// Crude validation for the date input.
var dateValidator = /^\d\d\d\d-[01]\d-[0-3]\d$/;
/**
* Set date from a ISO-formatted string, ie. 2011-11-28.
*/
Date.prototype.setISODate = function (input) {
if (dateValidator.test(input)) {
var parts = input.split('-');
diff --git a/menu_block.module b/menu_block.module
index 3925cdd..486da40 100644
--- a/menu_block.module
+++ b/menu_block.module
@@ -275,6 +275,11 @@ function menu_tree_build($config) {
if (!empty($patterns[$config['menu_name']])) {
$config['menu_name'] = $patterns[$config['menu_name']];
}
+ // If no match was found, fall back to the first candidate.
+ // This is a changed behavior form the standard behavior of menu_block.
diff --git a/menu_block.admin.inc b/menu_block.admin.inc
index 98f3bbb..143ed9a 100644
--- menu_block.admin.inc
+++ menu_block.admin.inc
@@ -423,7 +423,7 @@ function menu_block_configure_form($form, &$form_state) {
'#default_value' => $config['sort'],
'#description' => t('Sort each item in the active trail to the top of its level. When used on a deep or wide menu tree, the active menu item’s children will be easier to see when the page is reloaded.'),
);
- $form['parent_mlid'] = array(
+ $form['parent'] = array(
@mikl
mikl / index.js
Last active August 29, 2015 14:00
/*
Copyright (c) 2014, Mikkel Hoegh <mikkel@hoegh.org>
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
var Hapi = require('hapi');
var Joi = require('joi');
@mikl
mikl / keybase.md
Last active September 11, 2019 06:00

Keybase proof

I hereby claim:

  • I am mikl on github.
  • I am mikl (https://keybase.io/mikl) on keybase.
  • I have a public key ASAIWHSQKo6M5T4c3YhvSvdtldwPqEjRecLbvOrUQ7y3uwo

To claim this, I am signing this object: