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 spam protection for email addresses using jQuery. | |
| * Well, the protection isn’t jQuery-based, but you get the idea. | |
| * This snippet allows you to slightly ‘obfuscate’ email addresses to make it harder for spambots to harvest them, while still offering a readable address to your visitors. | |
| * E.g. | |
| * <a href="mailto:foo(at)example(dot)com">foo at example dot com</a> | |
| * → | |
| * <a href="mailto:foo@example.com">foo@example.com</a> | |
| */ | |
| $(function() { |
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
| public function buildQuery($query) | |
| { | |
| $sql=isset($query['distinct']) && $query['distinct'] ? 'SELECT DISTINCT' : 'SELECT'; | |
| $sql.=' '.(isset($query['select']) ? $query['select'] : '*'); | |
| if(isset($query['from'])) | |
| $sql.="\nFROM ".$query['from']; | |
| else | |
| throw new CDbException(Yii::t('yii','The DB query must contain the "from" portion.')); | |
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
| # via http://d.hatena.ne.jp/yukioc/20090920/1253413686 | |
| git config --global alias.log-all "log --graph --all --color --pretty='%x09%h %cn%x09%s %Cred%d%Creset'" |
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
| function timespan($time1, $time2 = NULL, $output = 'years,months,weeks,days,hours,minutes,seconds') | |
| { | |
| $output = preg_split('/[^a-z]+/', strtolower((string) $output)); | |
| if (empty($output)) | |
| return FALSE; | |
| extract(array_flip($output), EXTR_SKIP); | |
| $time1 = max(0, (int) $time1); | |
| $time2 = empty($time2) ? time() : max(0, (int) $time2); | |
| $timespan = abs($time1 - $time2); | |
| isset($years) and $timespan -= 31556926 * ($years = (int) floor($timespan / 31556926)); |
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 | |
| // cURL obeys the RFCs as it should. Meaning that for a HTTP/1.1 backend if the POST size is above 1024 bytes | |
| // cURL sends a 'Expect: 100-continue' header. The server acknowledges and sends back the '100' status code. | |
| // cuRL then sends the request body. This is proper behaviour. Nginx supports this header. | |
| // This allows to work around servers that do not support that header. | |
| curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); | |
| // We're emptying the 'Expect' header, saying to the server: please accept the body right now. | |
| // Read here: http://pilif.github.com/2007/02/the-return-of-except-100-continue/ |
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 | |
| namespace Acme\DemoBundle\Entity; | |
| class IP | |
| { | |
| /** | |
| * @var integer $id | |
| */ | |
| private $id; |
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 | |
| define('E_FATAL', E_ERROR | E_USER_ERROR | E_PARSE | E_CORE_ERROR | | |
| E_COMPILE_ERROR | E_RECOVERABLE_ERROR); | |
| define('ENV', 'dev'); | |
| //Custom error handling vars | |
| define('DISPLAY_ERRORS', TRUE); | |
| define('ERROR_REPORTING', E_ALL | E_STRICT); |
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
| username: vagrant | |
| password: vagrant | |
| sudo apt-get update | |
| sudo apt-get install build-essential zlib1g-dev git-core sqlite3 libsqlite3-dev | |
| sudo aptitude install mysql-server mysql-client | |
| sudo nano /etc/mysql/my.cnf |
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/bash | |
| while : | |
| do | |
| clear | |
| git --no-pager log --graph --pretty=oneline --abbrev-commit --decorate --all $* | |
| sleep 1 | |
| done |
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
| /* | |
| Based on Rick Strahl code | |
| http://www.west-wind.com/weblog/posts/2008/Mar/18/A-simple-formatDate-function-for-JavaScript | |
| Contributors: | |
| Clauber Stipkovic - @clauberhalic | |
| Mário Rinaldi - @MarioRinaldi | |
| */ | |
| Date.prototype.formatDate = function (format) { |
OlderNewer