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
In [2]: reverse('userbase.edit', kwargs={'id': 1}) | |
Out[2]: '/userbase/1/edit/' | |
In [3]: reverse('userbase.delete', kwargs={'id': 1}) | |
Out[3]: '/userbase/1/delete/' | |
In [4]: reverse('userbase.new') | |
Out[4]: '/userbase/new/' | |
In [5]: reverse('userbase.view', kwargs={'id': 1}) |
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 django.forms import ModelForm, TypedChoiceField | |
from .models import UserInfo | |
class UserInfoForm(ModelForm): | |
blood_group = TypedChoiceField(coerce=unicode) | |
gender = TypedChoiceField(coerce=int) |
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 collections import Iterable | |
def flatten(items): | |
for item in items: | |
if isinstance(item, Iterable): | |
yield from flatten(item) | |
else: | |
yield item | |
nested = [1, 3, [3, [4, 5, [6]]]] |
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
;; Steve yegge tips | |
;;; Replacement for using backspace | |
(global-set-key "\C-w" 'backward-kill-word) | |
(global-set-key "\C-x\C-k" 'kill-region) | |
(global-set-key "\C-c\C-k" 'kill-region) | |
;; Full screen | |
(toggle-frame-fullscreen) | |
;; Remove Toolbar | |
(tool-bar-mode -1) |
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
[website] | |
url = http://www.python.org |
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 May 14 2014] | |
*** You have joined channel #pyconindia [19:25] | |
*** Users on #pyconindia: kracekumar sayan gits1225 n3oo3n_ kirang89_ kaakku | |
chandankumar techglider_ anuragkr rx100 satyag haseeb_ theskumar Shaan7 | |
Hobbes` | |
*** #pyconindia modes: +cnt | |
*** #pyconindia was created on 2012-06-07 13:33:21 | |
*** rx100 (~rradhakri@64.138.135.2) has quit: Read error: Connection reset by | |
peer [19:27] |
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
# IPython interpreter | |
# Super as a constructor | |
In [52]: class A(object): | |
def __init__(self, *args, **kwargs): | |
self.a_name = kwargs.get('a_name') | |
super(A, self).__init__(*args, **kwargs) | |
....: | |
In [53]: class B(object): |
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
package main | |
import ( | |
"fmt" | |
"net/http" | |
"sync" | |
"time" | |
) | |
func basics() { |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Welcome to the Emacs shell | |
tests $ cd .. | |
intercom_integration $ cd .. | |
sample_proj $ workon sample | |
(sample) sample_proj $ ./test intercom_integration/tests/test_intercom_entity.py | |
Test session starts (platform: darwin, Python 2.7.5, pytest 2.6.1, pytest-sugar 0.3.4) | |
plugins: django, sugar | |
\r \x1b[1;30mintercom_integration/tests/\x1b[0mtest_intercom_entity.py \x1b[92m\u2713\x1b[0m 100% \x1b[92m\x1b[100m\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\x1b[0m\x1b[1;30m\x1b[100m\x1b[0m |
OlderNewer