Skip to content

Instantly share code, notes, and snippets.

Pablo Lopez plopesc

Block or report user

Report or block plopesc

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
@plopesc
plopesc / headers.php
Last active Aug 29, 2015
Get Header from URL
View headers.php
<?php
/**
* To execute this: php headers.php http.//url_to_check.com header
*/
$strURL = isset($argv[1]) ? $argv[1] : NULL;
$headerFind = isset($argv[2]) ? $argv[2] : NULL;
$resCurl = curl_init();
// Set URL and other appropriate options.
@plopesc
plopesc / update_field_definition.php
Last active Aug 29, 2015
Update the column structure for a field type.
View update_field_definition.php
<?php
/**
* Converts the value column from integer to float.
*/
function mymodule_update_70XX() {
$spec = array(
'type' => 'float',
'not null' => FALSE,
); // DB Column definition.
@plopesc
plopesc / enable_revision.php
Last active Aug 29, 2015
enable entity_translation revision support for existing site (Non previous revisionable data)
View enable_revision.php
<?php
/**
* Enables entity_translation revisions support.
*/
function my_module_update_70XX() {
$revisionable_entity_types = array();
$query = db_select('entity_translation', 'et')
->fields('et', array('entity_type'))
@plopesc
plopesc / remove_field.php
Last active Aug 29, 2015
Cleans all the data related to a field and uninstalls the module that provides that field
View remove_field.php
<?php
/**
* Removes my_field and uninstalls its module.
*/
function my_module_update_70XX(&$sandbox) {
// If this is the first pass through this update function then set some variables.
if (!isset($sandbox['total'])) {
$sandbox['field_name'] = 'my_field';
$sandbox['field'] = field_info_field($sandbox['field_name']);
$sandbox['module'] = array($sandbox['field']['module']);
@plopesc
plopesc / translate_variable.php
Last active Aug 29, 2015
Enables multilingual support for variables defined in a group.
View translate_variable.php
<?php
/**
* Enables multilingual support for variables defined in a group.
*
* @param string $group
* The group of variables to load
*/
function enable_multilingual_variables($group) {
// Load all the variables defined by group.
@plopesc
plopesc / 0_reuse_code.js
Created May 9, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.