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 | |
| class SearchController extends AppController | |
| { | |
| var $name = 'Search'; | |
| var $uses = array('Address', 'LiftVendor', 'SubVendor', 'ZipCode'); | |
| /* Search by zip code. */ | |
| function zip($zip_code) { | |
| set_time_limit(0); // Because this action could take a while... | |
| $this->layout = false; // Used through Ajax, so don't need a layout. |
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
| // Simple jQuery effect toggles. | |
| // Use just like the jQuery.toggle() method. | |
| // | |
| // $('#some-link').click(function() { | |
| // $('#some-div').slideToggle(); | |
| // }); | |
| jQuery.fn.fadeToggle = function() { | |
| if (this.css('display') == 'none') this.fadeIn(); | |
| else this.fadeOut(); |
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
| #!/usr/bin/env python | |
| import os | |
| import sys | |
| from optparse import OptionParser | |
| global DEBUG | |
| global APP_DIR | |
| global CAKE_DIR |
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 | |
| // Reason #5,671 PHP sucks balls: Can't set default array values | |
| // (default return values for non-existing keys). | |
| // Returns the $key's value from $array if it exists; otherwise return $default. | |
| function value_or_default($array, $key, $default = '') { | |
| return array_key_exists($key, $array) ? $array[$key] : $default; | |
| } |
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 | |
| // CakePHP does stupid shit often times. | |
| // http://api.cakephp.org/view_source/object/#line-112 | |
| function dispatchMethod($method, $params = array()) { | |
| if (empty($params)) return $this->{$method}(); | |
| // We only hit this if there are parameters passed ($params isn't empty). | |
| return call_user_func_array(array(&$this, $method), $params); | |
| } |
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 | |
| // Rounds the given timestamp (string) up 15 minutes. | |
| function round_timestamp($timestamp) { | |
| $interval = 15; // minutes | |
| $date_format = "%d-%b-%y %I:%M:%S %p %Z"; | |
| $time_array = strptime(strftime($date_format, strtotime($timestamp)), $date_format); | |
| $minutes = $time_array['tm_min']; | |
| $delta = $minutes % $interval; | |
| $time_array['tm_min'] = $minutes + ($delta * ($delta < $interval / 2 ? -1 : 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
| <!-- Add a class to the link and info elements. --> | |
| <li> | |
| <a class="show-info" href="#">Show The Element</a> | |
| <div class="info" style="display: none;"> | |
| Some content here. | |
| </div> | |
| </li> | |
| <!-- etc. --> |
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
| // Add the typical onclick jazz for selected links. | |
| // (Insert your framework of choice.) | |
| $('#tabs a').each(function(index, tab) { | |
| $(tab).attr('onclick', '; return false;'); | |
| }); |
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
| def run_tests(test_type) | |
| case test_type | |
| when :all | |
| system('rake test') | |
| when /(controllers|functional)\/?/ | |
| system('rake test:functionals') | |
| when /(models|unit)\/?/ | |
| system('rake test:units') | |
| else | |
| # do nothing... |
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
| ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[blue]%}(%{$fg[yellow]%}" | |
| ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
| ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})%{$fg[red]%}✗✗✗%{$reset_color%}" | |
| ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})───" | |
| PROMPT=$'\n%B%{$fg[blue]%}┌─[%b%{$fg[yellow]%}%D{%a %b %d, %I:%M:%S}%B%{$fg[blue]%}]%b | |
| %B%{$fg[blue]%}| [%{$fg[green]%}%n%b%{$fg[white]%}@%B%{$fg[cyan]%}%m%{$fg[blue]%}]%b%{$reset_color%} - %B%{$fg[blue]%}[%b%{$reset_color%}%~%B%{$fg[blue]%}]%b | |
| %B%{$fg[blue]%}└─[%{$fg[red]%}$%{$fg[blue]%}]$(git_prompt_info)%B%{$fg[blue]%}≫%b %{$reset_color%}' | |
| PS2=$' %B%{$fg[blue]%}➜%b%{$reset_color%} ' |