Skip to content

Instantly share code, notes, and snippets.

View kporras07's full-sized avatar

Kevin Porras kporras07

View GitHub Profile
@kporras07
kporras07 / popup-nacion
Created January 15, 2015 15:59
Quitar Popup de Grupo nación
javascript:(function()%20{var%20allBody%20=%20document.getElementsByTagName('body');%20var%20body%20=%20allBody[0].outerHTML;%20var%20regex%20=%20new%20RegExp(/\<div%20id="([0-9]+?)"%20style/);%20var%20matches%20=%20regex.exec(body);%20document.getElementById(matches[1]).remove();%20var%20grayDiv%20=%20document.getElementById('LNA_paywall_modal');%20grayDiv.parentNode.remove();%20})()
@kporras07
kporras07 / Popup Nacion
Created January 22, 2015 22:44
Eliminar popup nación
javascript:(function()%20{var%20allBody%20=%20document.getElementsByTagName('body');%20var%20body%20=%20allBody[0].outerHTML;%20var%20regex%20=%20new%20RegExp(/\<div%20id="([0-9]+?)"%20style/);%20var%20matches%20=%20regex.exec(body);%20document.getElementById(matches[1]).remove();%20var%20grayDiv%20=%20document.getElementById('LNA_paywall_modal');%20grayDiv.parentNode.remove();%20})()
@kporras07
kporras07 / hook_module_implements_alter
Created March 13, 2015 17:22
Use hook_module_implements_alter for changing hooks execution order.
/**
* Implements hook_module_implements_alter().
*/
function mymodule_module_implements_alter(&$implementations, $hook) {
// We need this hook running at the end.
if ($hook == 'form_alter' && isset($implementations['mymodule'])) {
$mymodule = $implementations['mymodule'];
unset($implementations['mymodule']);
$implementations['mymodule'] = $mymodule;
}
@kporras07
kporras07 / nodequeue.php
Last active November 6, 2015 01:41
Create Nodequeue
/**
* Helper function that creates the default nodequeues.
*/
function demo_create_default_nodequeues() {
$queue = nodequeue_load_queue_by_name('nodequeue_name');
if (!$queue) {
$nodequeue = new stdClass();
$nodequeue->name = 'nodequeue_name';
$nodequeue->title = 'My Nodequeue';
@kporras07
kporras07 / create_menu_link.php
Created November 6, 2015 01:36
Create Menu Link
@kporras07
kporras07 / create_taxonomy_term.php
Created November 6, 2015 01:52
Crear taxonomy term.
$vocabulary = taxonomy_vocabulary_machine_name_load($name);
$vid = $vocabulary->vid;
$term = new stdClass();
$term->vid = $vid;
$term->name = 'foo';
$term->description = 'bar';
taxonomy_term_save($term);
@kporras07
kporras07 / screenshot_behat.php
Last active January 21, 2016 21:06
Screenshot with behat selenium
<?php
/**
* This works for Selenium and other real browsers that support screenshots.
*
* @Then /^show me an screenshot$/
*/
public function showMeAnScreenshot() {
$image_data = $this->getSession()->getDriver()->getScreenshot();
// En Settings.php
$local_settings = __DIR__ . "/settings.local.php";
if (file_exists($local_settings)) {
include $local_settings;
}
if (empty($settings['hash_salt'])) {
$settings['hash_salt'] = hash('sha256', serialize($databases));
}
location / {
# try_files $uri @rewrite; # For Drupal <= 6
try_files $uri /index.php?$query_string; # For Drupal >= 7
}
@kporras07
kporras07 / install_drupal_console.sh
Created April 19, 2017 17:55
Install Drupal console on existing composer project.
composer require --dev drupal/console:~1.0 --prefer-dist --optimize-autoloader