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
var text = "var a = '"; | |
for (var i = text.length; i < 114686; i++) { | |
text += '1'; | |
} | |
text += "';"; | |
console.log('text size:', text.length); | |
var blob = new Blob([text], {type: 'text/javascript'}); | |
var url = URL.createObjectURL(blob); | |
var script = document.createElement('script'); |
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 -*- | |
""" | |
dbdamnit.py is a management command for creating and configuring MySQL | |
database settings automagically for Your Django project. This code | |
uses convention over configuration, feel free to modify and use it | |
for your own projects as You like. | |
Happy hacking! :) | |
- @uninen |
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
"""More specific helpers.""" | |
from django.conf import settings | |
from django.core.mail.message import EmailMessage | |
from datetime import date, timedelta | |
import os | |
from core.extdb import ExtDB |
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 functools import wraps | |
class tail(object): | |
def __init__(self, *args, **kwargs): | |
try: | |
self.func = args[0]._tail_function | |
except AttributeError: | |
self.func = args[0] | |
self.args = args[1:] | |
self.kwargs = kwargs |
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
curl -XPOST -d "source=`git config user.name`&from_address=`git config user.email`&subject=pushed to production&content=`git log --pretty=format:'%s %H' -n 1`" https://api.flowdock.com/v1/messages/team_inbox/YOUR_TOKEN_GOES_HERE |
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 SomeView(View): | |
def dispatch(self, request, *args, **kwargs): | |
# imports and start profiling | |
import cProfile, pstats, StringIO | |
pr = cProfile.Profile() | |
pr.enable() | |
# all logic runs here |
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 ExampleFormMultipleView(MultipleFormsView): | |
template_name = 'preferences/change_group_multiple.html' | |
forms = { | |
'profile': ProfileForm, | |
'avatar': AvatarForm, | |
'contacts': ContactsForm, | |
} | |
def forms_valid(self, forms): | |
for key, form in forms.items(): |
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
SELECT details.installer.name, COUNT(*) | |
FROM | |
TABLE_DATE_RANGE( | |
[the-psf:pypi.downloads], | |
TIMESTAMP("20160601"), | |
TIMESTAMP("20160630") | |
) | |
WHERE file.project='django-material' | |
group by details.installer.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
import re | |
""" | |
Detect browser and it's version. | |
Now it works only for few moct common browsers. Full list of browsers and | |
theire user-agent you can find here: http://www.useragentstring.com/pages/useragentstring.php | |
Version: 0.1 | |
Author: Andrey Nikishaev | |
Site: http://creotiv.in.ua/ |
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
[tox] | |
envlist = py36 | |
skipsdist = True | |
[testenv] | |
deps = django==2.0.6 | |
commands = {posargs:./manage.py runserver} | |
setenv = | |
PYTHONPATH={toxinidir} | |
PATH={envdir}/bin:{env:PATH} |
OlderNewer