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
| >>> d | |
| {'foo': 'bar'} | |
| >>> keys | |
| ['foo', 'spam'] | |
| >>> for key in keys: | |
| ... if not d.has_key(key): | |
| ... d[key] = None | |
| ... | |
| >>> d | |
| {'foo': 'bar', 'spam': None} |
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
| import xml.etree.ElementTree | |
| xml = xml.etree.ElementTree.parse("file.xml") | |
| root = xml.getroot() | |
| elem = xml.etree.ElementTree.Element("foo") |
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
| !Type:Cat | |
| NExpenses | |
| ^ | |
| !Type:Bank | |
| D05/08/2012 | |
| T50.00 | |
| Pexp four | |
| LAssets:Current Assets:Checking Account | |
| ^ | |
| !Type:Bank |
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 | |
| $adapter = $this->getAdapter(); | |
| $langQuoted = $adapter->quote($lang); | |
| $sql = " | |
| (SELECT * FROM `news` WHERE published = 1 AND lang = " . $langQuoted . ") | |
| UNION ALL | |
| (SELECT * FROM `events` WHERE published = 1 AND lang = " . $langQuoted . ") | |
| ORDER BY `date` DESC | |
| "; |
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 | |
| function rename_file() | |
| { | |
| NEWFILE=$(echo $1 | md5sum | cut -c-5)'.png' | |
| } | |
| API_KEY=PUT_YOUR_IMGUR_API_KEY_HERE | |
| URL=http://api.imgur.com/2/upload |
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
| (gdb) break php_pcre.c:1318 | |
| Breakpoint 1 at 0x49e066: file /home/robert/php/php5trunk/ext/pcre/php_pcre.c, line 1318. | |
| (gdb) run run-tests.php ext/pcre/tests/bug53823.phpt | |
| <<snip>> | |
| Breakpoint 1, preg_replace_impl (ht=3, return_value=0x7ffff1971518, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1, is_callable_replace=0, | |
| is_filter=0) at /home/robert/php/php5trunk/ext/pcre/php_pcre.c:1318 | |
| 1318 if (!is_callable_replace && Z_TYPE_PP(replace) == IS_ARRAY && Z_TYPE_PP(regex) != IS_ARRAY) { | |
| (gdb) print **subject |
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 -v | |
| PHP 5.3.10 (cli) (built: Feb 2 2012 22:12:16) | |
| Copyright (c) 1997-2012 The PHP Group | |
| Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies | |
| with Xdebug v2.2.0-dev, Copyright (c) 2002-2012, by Derick Rethans | |
| $ php -i | grep -A 2 xdebug | grep Version | |
| Version => 2.2.0-dev | |
| $ php -r 'var_dump("Testing");' | |
| string(7) "Testing" |
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
| robert@odin ~/www$ gdb php | |
| GNU gdb (GDB) Fedora (7.3.50.20110722-10.fc16) | |
| Copyright (C) 2011 Free Software Foundation, Inc. | |
| License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> | |
| This is free software: you are free to change and redistribute it. | |
| There is NO WARRANTY, to the extent permitted by law. Type "show copying" | |
| and "show warranty" for details. | |
| This GDB was configured as "x86_64-redhat-linux-gnu". | |
| For bug reporting instructions, please see: | |
| <http://www.gnu.org/software/gdb/bugs/>... |
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
| require([ | |
| 'dojo/ready', 'dojo/query' | |
| ], | |
| function (ready, query) { | |
| function callThat() { | |
| console.log(query("#id")); // works | |
| } | |
| ready(function() { | |
| callThat(); | |
| callThis(); |
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
| define([ | |
| 'dojo/query', | |
| 'dojo/dom-construct', | |
| 'dojo/dom-attr', | |
| 'dijit/Editor', | |
| "dijit/_editor/plugins/LinkDialog", | |
| "dijit/_editor/plugins/ViewSource" | |
| ], | |
| function(query, construct, attr, Editor) { | |