##Drupal
cache busting in Drupal
drupal_flush_all_caches()
drupal_clear_css_cache()
drupal_clear_js_cache()
getting the full URI of an image
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Foo</title> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /> | |
| <style type='text/css'> | |
| li { | |
| margin-left: 60px; | |
| } |
| // Shape the timestamp just so | |
| function formatTime(timestamp){ | |
| var time = new Date(timestamp * 1000); | |
| var hours = time.getHours()-(time.getTimezoneOffset()/60); // assuming behind the meridian | |
| var minutes = time.getMinutes(); | |
| minutes = minutes < 10 ? '0' + minutes : minutes; | |
| hours = hours > 12 ? hours - 12 : hours; | |
| if (hours === 0){ | |
| return '12:' + minutes + 'A.M.'; | |
| } else if (hours < 12) { |
| <?php | |
| /** | |
| * To discover information about the nodes in a given type | |
| * @param $type a string, choose a content type machine name | |
| * @return a string | |
| */ | |
| function get_nodes_statuses($type) { | |
| $result = db_query('SELECT n.nid, n.title, n.changed FROM {node} n WHERE n.type = :type', array(':type' => $type)); | |
| $i = 0; | |
| if ($result) { |
| { | |
| "folders": | |
| [ | |
| { | |
| "path": "/home/<USER>/workspace/<PROJECT>", | |
| "name": "root", | |
| "file_exclude_patterns": [ | |
| ".sasscache", "*.css" | |
| ] | |
| }, |
##Drupal
cache busting in Drupal
drupal_flush_all_caches()
drupal_clear_css_cache()
drupal_clear_js_cache()
getting the full URI of an image
| <?php | |
| function log_to_file($text) { | |
| $f = fopen('/tmp/my_log.txt', 'a'); | |
| fwrite($f, date('Ymd H:i:s - ') . $text . "\n"); | |
| fclose($f); | |
| } | |
| // to print arrays/objects use | |
| // log_to_file(print_r($obj, $return = TRUE)); |
| { | |
| "autosave": false, | |
| "color_scheme": "Packages/Color Scheme - Default/Monokai Bright.tmTheme", | |
| "default_line_ending": "unix", | |
| "ensure_newline_at_eof_on_save": true, | |
| "fallback_encoding": "UTF-8", | |
| "file_exclude_patterns": | |
| [ | |
| ".DS_Store" | |
| ], |
| # Path to your oh-my-zsh configuration. | |
| ZSH=$HOME/.oh-my-zsh | |
| #Environment Variables | |
| export PATH="/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/opt:$HOME/bin:$HOME/drush:/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5.3/bin:$PATH" | |
| export EDITOR=vim | |
| # Set name of the theme to load. | |
| ZSH_THEME="robbyrussell" | |
| COMPLETION_WAITING_DOTS="true" |
| /* | |
| * At the end of the settings.php file for drupal add these lines | |
| */ | |
| /** | |
| * settings file routing | |
| */ | |
| if (file_exists(dirname(__FILE__) . '/local.settings.php')) { | |
| include dirname(__FILE__) . '/local.settings.php'; | |
| } |
| //credit http://stackoverflow.com/questions/323517/is-there-an-equivalent-for-var-dump-php-in-javascript | |
| function dump(obj) { | |
| var out = ''; | |
| for (var i in obj) { | |
| out += i + ": " + obj[i] + "\n"; | |
| } | |
| alert(out); | |
| // or, if you wanted to avoid alerts... |