This Gist / Backtick command will make the issue queue description sticky when you scroll down the comments of the issue. Read more here: https://association.drupal.org/node/17983
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 | |
/** | |
* Implements hook_field_formatter_info(). | |
*/ | |
function edl_flowplayer_field_formatter_info() { | |
return array( | |
// the key must be unique, so it's best to prefix with your module's name. | |
'edl_flowplayer_flowplayer' => array( | |
// the label is is what is displayed in the select box in the UI. |
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 | |
if (count($argv) != 3) { | |
die('Usage: php remap-csv.php <infile> <outfile>'); | |
} | |
// in / out files are $argv[1] and $argv[2] | |
$in = fopen($argv[1], "r"); | |
$out = fopen($argv[2], "w"); |
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 | |
// Select all nodes of type Document | |
$result = db_select('node', 'n') | |
->fields('n', array('nid')) | |
->condition('type', 'document') | |
->execute(); | |
// create thumbnail and attach it | |
foreach($result as $row) { |
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 simple script adds the specified table prefix to all tables in the current DB. | |
// It is used if you want to add a prefix to all tables once the DB has been created. | |
// | |
// WARNING: Do not run on a DB which already uses prefixes to separate different databases. | |
// | |
// To run copy this script to the docroot of your Drupal installation and then do: | |
// |
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 | |
// Select all nodes of type article created by anonymous and admin | |
$result = db_select('node', 'n') | |
->fields('n', array('nid')) | |
->condition('type', 'article') | |
->condition('uid', array(0,1), 'IN') | |
->execute(); | |
// go through results and unpublish each article. |
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 | |
// Structure to use | |
$terms = array( | |
array('name' => 'Technical', 'weight' => 1, 'parent' => 0), | |
array('name' => 'Operations', 'weight' => 6, 'parent' => 0), | |
array('name' => 'Customer Relationship', 'weight' => 7, 'parent' => 0), | |
array('name' => 'Talent & Culture', 'weight' => 11, 'parent' => 0), | |
array('name' => 'Finance', 'weight' => 12, 'parent' => 0), | |
array('name' => 'Dev', 'weight' => 0, 'parent' => 'Technical'), |
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> |
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
<?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; |