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
#include <iostream> | |
struct test { | |
int a; | |
int a_square(); | |
}; | |
int test::a_square() | |
{ |
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 word_search(request): | |
match = request.GET.get('q') | |
result = [] | |
if match is not None and len(match) >= 2: | |
# We search different variants of spelling | |
variants = Variant.objects.filter( | |
Q(name__istartswith=match) | Q(downcoded__istartswith=match) | |
).values_list("entry__pk").order_by("name") |
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
// Search | |
$("#searchButton").click(function() { | |
var id = $("#id_word_1").val(); | |
if (id) { | |
location.replace("/dictionary/redirect/" + id + "/"); | |
return; | |
} | |
}); | |
$("#searchTop").submit(function() { | |
var id = $("#id_word_1").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
def save(self, *args, **kwargs): | |
if not self.slug: | |
self.slug = slugify(self.name) | |
if not self.slug_unique: | |
self.slug_unique = unique_slug(self.slug) | |
try: | |
if not self.added_by: | |
self.added_by_id = 9 | |
except Member.DoesNotExist: | |
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 TestSlugs(TestCase): | |
# This slug must be unique | |
b = BookPublisher(slug=self.slug) | |
self.assertRaises(IntegrityError, b.save) | |
#check if there's only one BookPublisher | |
self.assertEquals(BookPublisher.objects.count(), 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.apple.locate</string> | |
<key>Disabled</key> | |
<true/> | |
<key>ProgramArguments</key> | |
<array> |
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
function jsonp(url, callback, name, query) | |
{ | |
if (url.indexOf("?") > -1) | |
url += "&" + callback + "=" | |
else | |
url += "?"+ callback +"=" | |
url += name + "&"; | |
if (query) | |
url += encodeURIComponent(query) + "&"; | |
url += new Date().getTime().toString(); // prevent caching |
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
AssertionError: Tuples differ: (datetime.date(2011, 9, 19), N... != (datetime.datetime(2011, 9, 19... | |
First differing element 0: | |
2011-09-19 | |
2011-09-19 08:17:24 | |
- (datetime.date(2011, 9, 19), None) | |
+ (datetime.datetime(2011, 9, 19, 8, 17, 24), 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
[statusMapping mapKeyPath:@"item" toRelationship:@"item" withMapping:itemMapping]; | |
[statusMapping mapKeyPath:@"item" toRelationship:@"item" withMapping:serializationItemMapping serialize:YES]; |
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
static NSDateFormatter *monthYearFormatter; | |
#import "NSDate+DateUtils.h" | |
@implementation NSDate (DateUtils) | |
- (NSString *)stringMonthYear | |
{ | |
if (!monthYearFormatter) | |
{ | |
monthYearFormatter = [[NSDateFormatter alloc] init]; |
OlderNewer