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
diff --git a/django/db/backends/oracle/compiler.py b/django/db/backends/oracle/compiler.py | |
index cfc8a08..12d9ad6 100644 | |
--- a/django/db/backends/oracle/compiler.py | |
+++ b/django/db/backends/oracle/compiler.py | |
@@ -20,12 +20,12 @@ class SQLCompiler(compiler.SQLCompiler): | |
do_offset = with_limits and (self.query.high_mark is not None | |
or self.query.low_mark) | |
if not do_offset: | |
- sql, params = super(SQLCompiler, self).as_sql(with_limits=False, | |
- with_col_aliases=with_col_aliases) |
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
diff --git a/tests/foreign_object/models.py b/tests/foreign_object/models.py | |
index e774421..1c163f5 100644 | |
--- a/tests/foreign_object/models.py | |
+++ b/tests/foreign_object/models.py | |
@@ -278,7 +278,7 @@ class BrokenContainsRelation(StartsWithRelation): | |
@python_2_unicode_compatible | |
class SlugPage(models.Model): | |
- slug = models.TextField() | |
+ slug = models.CharField(max_length=20) |
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
import random | |
def simulate(bank=1000.0, percentage=2.0, races=10000): | |
min_odds = 2.4 | |
max_odds = 13.0 | |
sample_odds = [3,6,21,5.5,5.5,5,2.8,18,8,6.5,4,3.3,2.4,21,5,3.2,3.3,6.5,5.5,16,3.4,26] | |
original_bank = bank | |
want_to_win = (percentage / 100) * bank | |
races_run = 0 | |
wins = 0 |
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
cinst Atom -y | |
cinst cmder -y | |
cinst git -y | |
cinst git.install -y | |
cinst git-credential-winstore -Version 1.2.0.0 -y | |
cinst resharper -y | |
cinst sysinternals -y | |
cinst Devbox-Clink -y | |
cinst linqpad4 -y | |
cinst SublimeText3 -y |
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
// Being explicit with which settings file is used, allows two important properties. settings.py is ALWAYS in a production ready state, even if 'settingslocal' is accidentally checked into source control. The other nice side effect, is that every developers settings files are stored in source control - allowing each developer to share components of their settings files with their peers. | |
// runserver | |
python manage.py runserver --settings settingsjosh | |
// syncdb | |
python manage.py syncdb --settings settingsjosh |
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
public static class TestHelpers | |
{ | |
public static void ShouldEqualWithDiff(this string actualValue, string expectedValue) | |
{ | |
if (actualValue == expectedValue) return; | |
Console.WriteLine("Idx Expected Actual"); | |
Console.WriteLine("---------------------"); | |
var maxLength = Math.Max(actualValue.Length, expectedValue.Length); | |
for (int i = 0; i < maxLength; i++) |
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
diff --git a/django/db/models/functions.py b/django/db/models/functions.py | |
index ac24aa7..8139ec0 100644 | |
--- a/django/db/models/functions.py | |
+++ b/django/db/models/functions.py | |
@@ -44,8 +44,12 @@ class ConcatPair(Func): | |
def as_sqlite(self, compiler, connection): | |
self.arg_joiner = ' || ' | |
self.template = '%(expressions)s' | |
- self.coalesce() | |
- return super(ConcatPair, self).as_sql(compiler, connection) |
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
smeatonj ~/Development | |
$ python3 -m timeit -s 'from testif import without_if' 'without_if(0, 100)' | |
100000 loops, best of 3: 4.94 usec per loop | |
smeatonj ~/Development | |
$ python3 -m timeit -s 'from testif import with_if' 'with_if(0, 100)' | |
100000 loops, best of 3: 5.88 usec per loop | |
smeatonj ~/Development | |
$ python3 -m timeit -s 'from testif import without_if' 'without_if(0, 10000)' |
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
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to parse template uwsgi/uwsgi.ini.erb: | |
Filepath: /etc/puppet/modules/uwsgi/templates/uwsgi.ini.erb | |
Line: 16 | |
Detail: undefined method `sort_by' for #<String:0x2a4870f8> | |
at /etc/puppet/modules/uwsgi/manifests/init.pp:148 on node node.domain.com | |
Warning: Not using cache on failed catalog | |
Error: Could not retrieve catalog; skipping run |
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 ConcatWords(Func): | |
arg_joiner = " || ' ' || " | |
template = '%(expressions)s' | |
class SearchVector(SearchVectorCombinable, Func): | |
function = 'to_tsvector' | |
_output_field = SearchVectorField() | |
def __init__(self, *expressions, **extra): | |
expressions = [ConcatWords(*[Coalesce(expression, Value('')) for expression in expressions])] |