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 unittest import TestCase | |
from mock import patch | |
import external_module | |
class SomeHandler(object): | |
def authenticate_login(self): | |
external_module.authenticate() | |
external_module.login() | |
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
def test_should_return_200(self): | |
response = self.client.get(reverse('auth-registration')) | |
self.assertEqual(response.status_code, 200) | |
def test_shold_return_200_again(self): | |
request_factory = RequestFactory() | |
request = request_factory.get((reverse('auth-registration'))) | |
registration_view = RegistrationView.as_view() |
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 Test(object): | |
... pass | |
... | |
>>> t = Test() | |
>>> def fail(): | |
... raise Exception('raise') | |
... | |
>>> t.test = property( fail ) | |
>>> t.test | |
<property object at 0x7fc2e896c470> |
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 django.contrib import admin | |
from apps.books.models import Book, Genre, Author, Tag | |
class BookAdmin(admin.ModelAdmin): | |
pass | |
class GenreAdmin(admin.ModelAdmin): | |
pass |
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 Bullet(){ | |
function fire(){ | |
//move event | |
}; | |
function move(el){ | |
}; |
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
<div id='Page'> | |
<div id='Side'> | |
<div id='Header'> | |
<!-- ko with: commandline --> | |
<input type="text" data-bind='value: command' /> | |
<!-- /ko --> |
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
<!-- ko with: registration --> | |
<div style='display: none' data-bind='visible: visible'> | |
<div class='overlay' data-bind='click: toggle'></div> | |
<div id='Registration' class='clearfix'> | |
<a class='close' data-bind='click: toggle'>X</a> | |
<div class='normal'> | |
<h2>Register</h2> |
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 Observer | |
constructor : (data, fn, ignore=[])-> | |
@listen = false | |
result = ko.dependentObservable -> | |
for key, val of data | |
if ko.isObservable(val) and key not in ignore | |
val() |
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 Project | |
constructor : -> | |
@data = | |
id : ko.observable() | |
name : ko.observable() | |
client : ko.observable() | |
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 django.core.management import setup_environ | |
import settings | |
setup_environ(settings) | |
from django.db import connection | |
from apps.books.models import Book | |
books = Book.objects.raw( """ | |
select * |
OlderNewer