Skip to content

Instantly share code, notes, and snippets.

View keybase.md

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:

View index.js
/*
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');
View menu_block_illegal_choice_in_parent-1203646-4.patch
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(
View 2012-08-31-menu_block-default-fallback.patch
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.
@mikl
mikl / setISODate.js
Created Nov 28, 2011
This illustrates pretty well why Date is my least favorite part of JavaScript…
View setISODate.js
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('-');
View emogrifier.php
<?php
/*
THE EMOGRIFIER LICENSE
Copyright (c) 2008-2011 Pelago (http://www.pelagodesign.com/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
View session-node-type.php
<?php
// $Id$
/**
* @file
* This is a dump of the session node type from the DrupalCon Copenhagen site.
*/
$content['type'] = array (
View drupalcon-attendee-data.sql
-- Select the fields we need.
SELECT u.uid AS uid,
u.name AS username,
TRIM(n.title) AS real_name,
ctp.field_profile_nametag_value AS nametag_name,
ctp.field_profile_company_value AS company,
ctp.field_profile_drupal_value AS drupal_org_name,
ctp.field_profiler_do_uid_value AS drupal_org_uid,
ctp.field_profiler_twitter_value AS twitter_name,
ctp.field_profile_country_value AS country,
View drupalcon-session-dump.sql
-- Alias all the fields we want.
SELECT cts.field_session_day_value AS session_day,
cts.field_session_time_value AS session_time,
cts.field_session_room_value AS session_room,
n.title AS session_title,
pn.title AS presenter_name,
td.name AS track_name
-- Start with the session table
FROM content_type_session AS cts
-- Get the main node data to eliminate unpublished nodes and the author uid.
View cleanup-regex.txt
%s/\vtlf. (\d+) (\d+),/\1\2,/gc
%s/, e-mail /,/gc
%s/\v, (\d\d\d\d) ([A-ZÆØÅÉ])/,\1,\2/gc
%s/\v^([a-zA-Z0-9.'æøåÆØÅéü' &\/\(\)-]+) (\d+),/\1, \2,/gc
%s/, \+/,/gc
%s/,/;/g
%s/\v^([^;]+);([^;]+) (\d\d\d\d\d\d)/\1, \2;\3/gc
%s/\v^([^;]+;[^;]+;[^;]+);([^;]+;\d\d\d\d)/\1, \2/g