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 collections | |
itemData = collections.defaultdict(list) | |
print('Reading rows...') | |
for row in range(10, 19): | |
# Each row in the spreadsheet has data for one item. | |
item = sheet['A' + str(row)].value | |
itemData['item'].append(item) | |
description = sheet['C' + str(row)].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
import codecs | |
import csv | |
import sys | |
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) | |
with open('sample.csv', encoding='utf-8') as inf: | |
r = csv.reader(inf) | |
for line in r: | |
print(line) |
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 count in range(0, multis) -%} | |
%{{ count %}} & A & B & C & D\\ \hline | |
%{ set count = count + 1 -%} | |
%{ endfor -%} | |
%{{ multis %}} & X & X & X & X\\ \hline |
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
;; There's something similar in vc-git.el: vc-git-grep. Naturally, | |
;; though, I prefer this :) | |
;; --perl-regexp seems to be the most flexible flavor; in particular, | |
;; it's the only one I know of that supports '\b' to mean "word | |
;; boundary". Unfortunately, not all gits have the requisite support; | |
;; for example, on OS X with homebrew, I had to pass "--with-pcre" to | |
;; "brew install git". | |
;; -I means don't search through binary files |
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
On second thought, _don't_ read me. | |
I'm working on a feature!! | |
Some second work on that feature. | |
This is where we actually fix it. |
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
mystring1 = "cat" | |
mystring2 = "doge" | |
cmds = ['test %s' % mystring1, 'test 2 %s' % mystring2] | |
for cmd in cmds: | |
print cmd |
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
;; Worst. Feature. Evar. | |
(when (fboundp 'electric-indent-mode) | |
(electric-indent-mode 0)) |
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
(when (eq window-system 'ns) | |
(global-set-key (kbd "M-`") 'other-frame) | |
(defun set-appropriate-font (frame) | |
(interactive "i") | |
(setq frame (or frame (selected-frame))) | |
(cl-flet ((points (pix) (+ 20 (round (- pix 1440) 200 )))) | |
(set-frame-font | |
(format "Inconsolata-%s" (points (display-pixel-height))) | |
nil |
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
(erc-mode-abbrev-table) | |
"ams" 6 "http://toroid.org/ams/git-website-howto" | |
"atm" 71 "at the moment" | |
"bas" 265 "/me backs away slowly" | |
"ce" 1 "/me cackles evilly" | |
"ct" 21 "/me clears throat" | |
"ddtt" 6 "Don't Do That, Then®" | |
"dli" 84 "/me dances like an idiot in the end zone" | |
"dtrt" 6 "Do The Right Thing™" |
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 sorted_alphanumerically(strings, key=None): | |
"""Sort alphabetically, except treat strings of digits as numbers. | |
If key is not None, it must return a string. | |
>>> sorted_alphanumerically(['r1', 'r10', 'r2']) | |
['r1', 'r2', 'r10'] | |
>>> sorted_alphanumerically(['r1', 'R10', 'r2']) | |
['R10', 'r1', 'r2'] | |
>>> sorted_alphanumerically(['r1', 'R10', 'r2'], key=str.lower) | |
['r1', 'r2', 'R10'] |