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 | |
// | |
// This code uses the _locale_import_po() function call from includes/locale.inc. This | |
// is a private function so use with care. Here's the function: | |
// https://api.drupal.org/api/drupal/includes%21locale.inc/function/_locale_import_po/7 | |
// | |
// example usage: | |
$translation_filepath = drupal_get_path('module', '<module>') . '/translations-es.po'; |
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 | |
// List of nids of the nodes to add | |
$nids = array(6474, 6475); | |
// Get queue and subqueue information | |
$queue_machine_name = 'queuename'; | |
$queue = nodequeue_load_queue_by_name( $queue_machine_name ); | |
// Get subqueues |
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 table_name, table_rows, data_length, index_length, | |
round(((data_length + index_length) / 1024 / 1024),2) "Size in MB" | |
FROM information_schema.TABLES | |
WHERE table_schema = "drupal" | |
ORDER BY round(((data_length + index_length) / 1024 / 1024),2) DESC | |
LIMIT 0,30; |
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 | |
// ------------------------------------------------------------------------- | |
// | |
// Taken from: | |
// http://worldofdrupal.blogspot.com.ar/2014/01/drupal-7-apache-solr-custom-query.html | |
// | |
// ------------------------------------------------------------------------- | |
// Search parameters |
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
var UTIL = (function (my, $) { | |
// private variables | |
var privateVariable = 1; | |
// private methods | |
function privateMethod() { | |
// ... | |
} |
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 | |
/** | |
* Update site to ... | |
* | |
* First comment is used when displaying updates to perform. Implementation of | |
* hook_update_N(). | |
*/ | |
function xxxx_update_700X() { |
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
name = Really Neat Widget | |
description = Provides a really neat widget for your site's sidebar. | |
core = 7.x | |
package = Views | |
dependencies[] = views | |
dependencies[] = panels | |
files[] = tests/example.test | |
configure = admin/config/content/example |
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 | |
// Create a node by code | |
$newNode = new stdClass(); | |
$newNode->type = 'page'; | |
node_object_prepare($newNode); | |
$newNode->title = 'This is the title of the new node'; | |
$newNode->status = 1; | |
$newNode->comment = 1; |
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 | |
$img = imagecreatefrompng ( '/tmp/image.png' ); | |
$palette = build_palette($img, 20, 20); | |
$unique_colors = array(); | |
foreach($palette as $row) { | |
foreach($row as $col) { | |
$rgb = sprintf('%02x%02x%02x', $col['r'], $col['g'], $col['b']); | |
if (!isset($unique_colors[$rgb])) { |
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
<div class="container"> | |
<div class="box" style="background-color:#04263c"></div> | |
<div class="box" style="background-color:#042e3c"></div> | |
<div class="box" style="background-color:#043644"></div> | |
<div class="box" style="background-color:#044254"></div> | |
<div class="box" style="background-color:#045264"></div> | |
<div class="box" style="background-color:#045664"></div> | |
<div class="box" style="background-color:#042e44"></div> | |
<div class="box" style="background-color:#043a4c"></div> | |
<div class="box" style="background-color:#043e4c"></div> |