Skip to content

Instantly share code, notes, and snippets.

Salvador Molina Moreno salvamomo

Block or report user

Report or block salvamomo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@salvamomo
salvamomo / migration_base_class.inc
Last active Jun 22, 2018
Drupal 7 - Disable rules before migration, re-enable afterwards.
View migration_base_class.inc
/**
* Your base class for migrations (or simply your custom migration class).
*/
abstract class YourMigrationBaseClass extends Migration {
/**
* Runs before an import starts.
*
* Used to disable any rules which could cause problems during
* the import.
@salvamomo
salvamomo / menus.js
Created Sep 9, 2016
Get OSX native 'edit' menu for node-webkit apps.
View menus.js
// initialize window menu
// Nicked from http://stackoverflow.com/a/28508923
var win = gui.Window.get(),
nativeMenuBar = new gui.Menu({
type: "menubar"
});
// check operating system for the menu
if (process.platform === "darwin") {
nativeMenuBar.createMacBuiltin("Your App Name");
@salvamomo
salvamomo / flood.inc
Last active Jul 22, 2016
Function flood prevention for Drupal 7.
View flood.inc
<?php
/**
* Checks whether a function can be called without falling on "flood" usage.
*
* USAGE: This function returns TRUE if the call to the desired function can be
* safely made. If not, it will stop execution for 3 seconds. A caller function
* can then use it to check for a negative value, and make a recursive call to
* themselves until this returns TRUE.
*
@salvamomo
salvamomo / emmet_wrapper.module
Last active Jul 6, 2018
PHP Code to convert an emmet-like string into HTML markup, with a string of content within it.
View emmet_wrapper.module
<?php
/**
* @file
* emmet_wrapper module.
* Helper classes to wrap contents with markup generated from emmet strings.
*/
/**
* Expands an emmet-like string into actual HTML markup.
View reply_add_form.inc
<?php
/**
* @file
* Plugin to display the reply add form for a given entity and field.
*/
/**
* Plugins are described by creating a $plugin array which will be used
* by the system that includes this file.
You can’t perform that action at this time.