Skip to content

Instantly share code, notes, and snippets.

View salvamomo's full-sized avatar

Salvador Molina Moreno salvamomo

View GitHub Profile
@salvamomo
salvamomo / reply_add_form.inc
Created April 16, 2015 18:00
Reply Add Form
<?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.
@salvamomo
salvamomo / emmet_wrapper.module
Last active July 6, 2018 20:46
PHP Code to convert an emmet-like string into HTML markup, with a string of content within it.
<?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.
@salvamomo
salvamomo / flood.inc
Last active July 22, 2016 11:56
Function flood prevention for Drupal 7.
<?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 / menus.js
Created September 9, 2016 09:06
Get OSX native 'edit' menu for node-webkit apps.
// 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 / migration_base_class.inc
Last active June 22, 2018 08:17
Drupal 7 - Disable rules before migration, re-enable afterwards.
/**
* 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 / Console.gd
Created June 12, 2020 06:50 — forked from xdl/Console.gd
Godot debug/interpreter console
extends Control
# Mostly inspired off https://www.youtube.com/watch?v=80cwYGvKB9U
# and https://github.com/godotengine/godot/issues/8003
onready var input_node: LineEdit = $Input
onready var output_node: TextEdit = $Output
# Dump some commands in here for convenience
var history = ["get_tree().get_root().get_node('Main')"]