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 | |
| function safe_truncate_text($text, $lenght) | |
| { | |
| $trailingDots = ''; | |
| $truncatedText = substr($text . ' ', 0, $lenght); | |
| if (strlen($text) > $lenght) | |
| { | |
| $truncatedText = preg_replace('/ [^ ]+$/', '', ' ' . $truncatedText); |
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 SampleObject extends Doctrine_Record | |
| { | |
| public function setId($value) | |
| { | |
| $this->_values['id'] = $value; | |
| $this->_set('id', $value); | |
| } | |
| } |
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 registerNS(ns) { | |
| var nsParts = ns.split('.'); | |
| var root = window; | |
| for(var i = 0; i < nsParts.length; i++) { | |
| if(typeof root[nsParts[i]] == 'undefined') { | |
| root[nsParts[i]] = new Object(); | |
| } | |
| root = root[nsParts[i]]; | |
| } |
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 | |
| function is_ajax() { | |
| return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')); | |
| } |
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 | |
| function unhtmlentities($string) { | |
| $string = preg_replace_callback('~&#x([0-9a-f]+);~i', function ($matches) { return chr(hexdec($matches[0])); }, $string); | |
| $string = preg_replace_callback('~&#([0-9]+);~', function ($matches) { return chr((int) $matches[0]); }, $string); | |
| $trans_tbl = get_html_translation_table(HTML_ENTITIES); | |
| $trans_tbl = array_flip($trans_tbl); | |
| return strtr($string, $trans_tbl); |
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
| sqlite old.db .dump | sqlite3 new.db |
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
| DBQuery.shellBatchSize = 300 |
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
| PS1='${debian_chroot:+($debian_chroot)}[\[\033[0;37m\]\t\[\033[00m\]] \[\033[0;94m\]\u\[\033[00m\] is `if [ \$? = 0 ]; then echo -e "\[\033[32m\]happy\[\033[00m\]"; else echo -e "\[\033[31m\]sad\[\033[00m\]"; fi` in \[\033[0;36m\]\w\[\033[00m\]$( | |
| s="" | |
| if [[ -d ".svn" ]] ; then | |
| r=`svn info 2>&1 | grep "Revision: " | cut -d " " -f 2` | |
| b= | |
| url=`svn info 2>&1 | awk "/URL:/ {print $2}"` | |
| if [[ $url =~ trunk ]]; then | |
| b="trunk" | |
| elif [[ $url =~ /branches/ ]]; then |
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 ($resultSet = array(); ($row = $result->fetch_object()) !== null; array_push($resultSet, $row)); |
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
| mongo <DB> --eval 'db.dropDatabase();' |
OlderNewer