This file contains 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 | |
# | |
# Add all of your Drupal nodes to the search index. | |
# | |
# NOTE: | |
# * This should work when you have around 10 000 nodes. | |
# * I assume you have set search to add 500 nodes per cron run. | |
# * There are better ways of doing this, but it does the job. | |
# |
This file contains 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
#!/usr/bin/env python | |
# | |
# Check if a website is loading and contains a nominated string. | |
# | |
# Usage: | |
# site-up.py http://example.com/ 'text to search for' | |
# | |
This file contains 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
for mod in $(find -maxdepth 2 -type d | egrep -v '\(.|.git|js|css|model|include|plugins\)$'); do name=$(echo $mod | sed -e 's/^.*\/\(.*\)$/\1/'); echo Processing $name; drush coder-review style comment security sql $name; done |
This file contains 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
/** | |
* Arduino LeoStick "Police Car" | |
* | |
* Written by Dave Hall - http://davehall.com.au | |
* | |
* Licensed under the terms of the WTFPL - http://sam.zoy.org/wtfpl/ | |
*/ | |
int SPEAKER = 11; | |
int LED_GREEN = 9; |
This file contains 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/sh | |
# | |
# Install and configure cURL with SSL support on RHEL 5 (and derivatives) | |
# | |
yum install curl -y | |
wget http://curl.haxx.se/ca/cacert.pem -O /etc/pki/tls/certs/ca-bundle.crt |
This file contains 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
$res = db_query('SELECT * FROM views_display WHERE ...'); | |
while ($record = db_fetch_array($res)) { | |
$options = unserialize($record['display_options']); | |
$options['cache'] = array( | |
'type' => 'time', | |
'results_lifespan' => 3600, | |
'output_lifespan' => 3600, | |
); | |
db_update('views_display') |
This file contains 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 | |
$amount = 12.50; | |
print (int) $amount * 100; # => 1200 # My implementation. I was wrong. | |
print (int) ($amount * 100); # => 1250 # After bugfix. PHP first casts, then multiplies. |
This file contains 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 | |
// ... | |
$properties['url'] = array( | |
'label' => t('URL'), | |
'description' => t("The URL of the job's view page."), | |
'getter callback' => 'mymod_entity_metadata_get_properties', | |
'type' => 'uri', | |
'computed' => TRUE, | |
); | |
// ... |
This file contains 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 | |
/** | |
* Extract list of PHP function aliases and output it as a PHP array string. | |
*/ | |
$source = file_get_contents('http://sprunge.us/EaEe'); | |
$xml = new SimpleXMLElement($source); | |
echo "<php\n\$alises = array(\n"; |
This file contains 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
; Example drush make file using the github download type. | |
api = 2 | |
core = 7 | |
projects[] = drupal | |
; Module | |
projects[bean_boxes][type] = "module" | |
projects[bean_boxes][download][type] = "github" |
OlderNewer