Skip to content

Instantly share code, notes, and snippets.

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 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
# 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}}
# frobnicator.py
class Frobnicate(object):
def gurgle(self):
...
def bargle(self):
...
# test_frobnicator.py
(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)))
@jorgenschaefer
jorgenschaefer / gist:5647175
Created May 24, 2013 23:23
Google+ Stylish Style Sheet
@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 */
class Foo(object):
def __enter__[]
==>
class Foo(object):
def __enter__(self):
[]
<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"
<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
(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)