This file contains 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
from mock import patch | |
class RealOne(object): | |
def quack(self): | |
print '> quack' | |
class BarDescriptor(object): | |
def __get__(self, obj, type=None): |
This file contains 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 un-camelcase-string (s &optional sep start) | |
"Convert CamelCase string S to lower case with word separator SEP. | |
Default for SEP is a hyphen \"-\". | |
If third argument START is non-nil, convert words after that | |
index in STRING." | |
(let ((case-fold-search nil)) | |
(while (string-match "[A-Z]" s (or start 1)) | |
(setq s (replace-match (concat (or sep "-") | |
(downcase (match-string 0 s))) |
This file contains 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
>>> from mock import create_autospec | |
>>> class A(object): | |
... def __init__(self, data): | |
... self.cleaned_data = data | |
... | |
>>> m_A = create_autospec(A) | |
>>> m_A({'a': 'b'}).cleaned_data | |
Traceback (most recent call last): | |
File "<ipython-input-5-66064b709d22>", line 1, in <module> | |
m_A({'a': 'b'}).cleaned_data |
This file contains 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 sublime-text-2 () | |
(interactive) | |
(color-theme-install | |
'(sublime-text-2 | |
((background-color . "#171717") | |
(background-mode . light) | |
(border-color . "#1a1a1a") | |
(cursor-color . "#fce94f") | |
(foreground-color . "#cfbfad") | |
(mouse-color . "black")) |
This file contains 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 A(object): | |
def __init__(self): | |
self.foo = 'foofoo' | |
def print_foo(self): | |
print self.foo | |
pf = A().print_foo | |
pf() |
This file contains 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
#!/usr/bin/env node | |
var path = require('path'), | |
Module = require('module'), | |
fs = require('fs'); | |
if (path.existsSync('./slug.js')) { | |
return Module._load('./slug.js'); | |
} | |
require('../lib/hem').exec(); |
This file contains 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
;;;; get back | |
(defun frame-bck() | |
(interactive) | |
(other-window -1)) | |
(global-set-key [?\C-x ?\O] 'frame-bck) |
This file contains 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 python-get-runcmd-for-current-unit-test () | |
"Runs current python unit-test." | |
(interactive) | |
(defun get-test-name () | |
(setq before-everything (point)) | |
(setq def-start (search-backward "def ")) | |
(forward-char (length "def ")) | |
(setq name-start (point)) |
This file contains 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
# -*- coding: utf-8 -*- | |
from collections import defaultdict | |
def get_row_key(row): | |
return str(row[4] + row[15]) | |
def main(): |
This file contains 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
Wed Jan 23 12:01 2013 Time and Allocation Profiling Report (Final) | |
duplicates +RTS -p -RTS /home/kb/Ubuntu One | |
total time = 44.42 secs (44417 ticks @ 1000 us, 1 processor) | |
total alloc = 4,068,850,736 bytes (excludes profiling overheads) | |
COST CENTRE MODULE %time %alloc | |
insert Data.IxSet.Ix 33.1 13.9 |
OlderNewer