Skip to content

Instantly share code, notes, and snippets.

View vinyll's full-sized avatar
🗺️
Creating locally

Vincent Agnano vinyll

🗺️
Creating locally
View GitHub Profile
@vinyll
vinyll / output
Created December 11, 2013 14:36
AMO test errors
(venv)vinyll@vinyll ~/P/z/src> dj test --logging-clear-handlers --noinput --settings=settings_local
nosetests --with-fixture-bundling --exclude=mkt/* --logging-clear-handlers --verbosity=1
Reusing old database "test_zamboni". Set env var FORCE_DB=1 if you need fresh DBs.
...................Exception pyes.urllib3.connectionpool.MaxRetryError: MaxRetryError('Max retries exceeded for url: /_bulk',) in <bound method ES.__del__ of <pyes.es.ES object at 0x10687d710>> ignored
No handlers could be found for logger "z.task"
Exception pyes.urllib3.connectionpool.MaxRetryError: MaxRetryError('Max retries exceeded for url: /_bulk',) in <bound method ES.__del__ of <pyes.es.ES object at 0x106881790>> ignored
../Volumes/Users/vinyll/Projects/zamboni/src/apps/addons/models.py:360: DeprecationWarning: object.__new__() takes no parameters
return super(Addon, cls).__new__(cls, *args, **kw)
...Exception pyes.urllib3.connectionpool.MaxRetryError: MaxRetryError('Max retries exceeded for url: /_bulk',) in <bound method ES.__d
@vinyll
vinyll / models.py
Last active June 3, 2023 17:00
Advanced user inheritance with Django
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import (AbstractBaseUser,
BaseUserManager as DjBaseUserManager)
from model_utils.managers import InheritanceManager
class BaseUserManager(DjBaseUserManager, InheritanceManager):
"""
class FizzBuzz
def initialize
@fizz = 3
@buzz = 5
end
def convert(num)
return "FizzBuzz" if isDivisibleBy(@fizz, num) && isDivisibleBy(@buzz, num)
return "Fizz" if isDivisibleBy(@fizz, num)
@vinyll
vinyll / wtfjs-parseint.js
Created December 3, 2012 08:08
wtfjs parseint on big numbers
parseInt("10000000000000000", 10) + 1
//10000000000000000
parseInt("10000000000000000", 10) + 2
//10000000000000002
parseInt("10000000000000000", 10) + 3
//10000000000000004
parseInt("10000000000000000", 10) + 4
//10000000000000004
parseInt("10000000000000000", 10) + 5
//10000000000000004
@vinyll
vinyll / django-crossdomainxhr-middleware.py
Created March 15, 2012 09:01 — forked from vicalejuri/django-crossdomainxhr-middleware.py
Middlware to allow's your django server to respond appropriately to cross domain XHR (postMessage html5 API).
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
from django import http
from django.conf import settings
XS_SHARING_ALLOWED_ORIGINS = getattr(settings, 'XS_SHARING_ALLOWED_ORIGINS', '*')