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_menu(). | |
| */ | |
| function deploy_services_client_menu() { | |
| $items = array(); | |
| //$items['job/%wf_job/diff/entities'] = array( | |
| // dev hack | |
| $items['job/123/diff/entities'] = array( |
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 | |
| /** | |
| * Extract a list of all available Organic Groups. | |
| * | |
| * This is ugly and inefficient, but it is the only way | |
| * I could figure out how to do it, but hey it works. | |
| * | |
| * This is designed to work with OG 7.x-2.x | |
| * |
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
| ; 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" |
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 | |
| /** | |
| * 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 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 | |
| // ... | |
| $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 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 | |
| $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 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
| $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 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/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 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
| /** | |
| * 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 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
| 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 |