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 foo(): | |
print 23 | |
# Now an empty line. In a REPL, Python does not know if the user | |
# finished the definition of the function foo, or if it will | |
# continue. So it assumes the empty line terminates the current | |
# open code block. | |
# In the REPL, this would now cause a "bad indentation" error, | |
# because the definition of foo() ended above. In an actual | |
# program, this works. |
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
;; This is a bad idea. | |
(defun restart-process (process) | |
(let ((name (process-name process)) | |
(buffer (process-buffer process)) | |
(program-and-args (process-command process)) | |
(sentinel (process-sentinel process)) | |
(filter (process-filter process)) | |
(new-process)) | |
(with-current-buffer buffer |
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
# install_wiki.yml | |
--- | |
[... other installation stuff, including templates ...] | |
# The templates etc. use up to 10 different configuration options for | |
# each wiki. The following only uses the "name" attribute, but it's | |
# the most complicated one as it involves another with_items loop. | |
- name: wiki | Install mediawiki files for {{wiki.name}} | |
file: src=/usr/share/mediawiki/{{item}} | |
dest=/srv/emcom/{{wiki.name}}/{{item}} |
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
# frobnicator.py | |
class Frobnicate(object): | |
def gurgle(self): | |
... | |
def bargle(self): | |
... | |
# test_frobnicator.py |
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
(global-set-key (kbd "C-x 8 p") 'fc/unicode-info-at-point) | |
(defun fc/unicode-info-at-point (&optional do-kill) | |
"Display the unicode name of the character at point." | |
(interactive "P") | |
(let ((char-code (elt (thing-at-point 'char) 0)) | |
name) | |
(setq name (get-char-code-property char-code 'name)) | |
(when (or (not name) | |
(= ?< (elt name 0))) | |
(setq name (get-char-code-property char-code 'old-name))) |
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
@namespace url(http://www.w3.org/1999/xhtml); | |
@-moz-document domain("plus.google.com") { | |
/* Some code taken from Layout Fixes for Google+ by MarkG76 */ | |
/* | |
* Show full posts and full comments | |
*/ | |
/* Show the full post and comment right away */ |
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
class Foo(object): | |
def __enter__[] | |
==> | |
class Foo(object): | |
def __enter__(self): | |
[] |
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
<0>orion:~$ cat foo.sh | |
#!/home/forcer/bar.sh | |
echo "FOO=$FOO" | |
<0>orion:~$ cat bar.sh | |
#!/usr/bin/env bash | |
FOO="yep" | |
source "$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
<0>orion:~$ cat foo.sh | |
#!/home/forcer/bar.sh | |
print "Hello, World" | |
<0>orion:~$ cat bar.sh | |
#!/usr/bin/env bash | |
python "$1" | |
<0>orion:~$ ./foo.sh | |
Hello, World |
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
(defun minibuffer-complete () | |
"Complete the minibuffer contents as far as possible. | |
Return nil if there is no valid completion, else t. | |
If no characters can be completed, display a list of possible completions. | |
If you repeat this command after it displayed such a list, | |
scroll the window of possible completions." | |
(interactive) | |
;; If the previous command was not this, | |
;; mark the completion buffer obsolete. | |
(setq this-command 'completion-at-point) |