This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$file = system_retrieve_file($remote_file_url); | |
$node->field_image[$node->language][] = (array) $file; | |
node_save($node); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$time_start = microtime(true); | |
$myArray = array(); | |
for ($i = 0; $i < 100000; ++$i) { | |
$myArray[] = $i; | |
$myArray[] = 'test a string'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function update () { | |
sudo apt-get update -y && echo "" && \ | |
sudo apt-get dist-upgrade -y && echo "" && \ | |
sudo apt-get upgrade -y && echo "" && \ | |
sudo apt-get autoremove -y && echo "" && \ | |
sudo localepurge && echo "" && \ | |
sudo deborphan | xargs sudo apt-get remove -y --purge && echo "" && \ | |
sudo apt-get autoclean -y && echo "" && \ | |
sudo apt-get moo | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd drupal | |
sudo rm -fr vendor | |
composer install | |
sudo chmod 777 sites/default | |
cd sites/default | |
rm -fr settings.php services.yml | |
# for developers only (sets up some dev mode settings, do this before install!) | |
cp ../example.settings.local.php ./settings.local.php | |
# for everyone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * | |
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS | |
WHERE CONSTRAINT_TYPE = 'FOREIGN KEY' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
docker stop `docker ps -aq` | |
docker rm `docker ps -aq` | |
docker rmi `docker images -aq` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function demo_deploy_update_7001() { | |
# Reverting a feature should not be done in the visual interface | |
# or using drush fr, but should rather be done in the hook_update_n(). | |
# To determine the component name (example views_view), make sure you are | |
# using version 2.x of Features, and visit the page for your features. | |
# In parentheses you will see the machine name for each component. | |
features_revert(array( | |
'demo_feature' => array( | |
'views_view', | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Convertir muchos documentos de DOC a ODT y otros formatos: | |
libreoffice --invisible --convert-to odt *.doc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implement of drush_hook_COMMAND_validate(). | |
* | |
* Prevent catastrophic sql-sync to live. Note that this file has to be local to the | |
* machine that intitiates sql-sync command. | |
*/ | |
function drush_policy_sql_sync_validate($source = NULL, $destination = NULL) { | |
if (strstr($destination, '.prod')) { |