Moved here:
This file contains hidden or 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
# django | |
from django import forms | |
from django.contrib.staticfiles.templatetags.staticfiles import static | |
from django.forms import Media, widgets | |
from django.utils.functional import cached_property | |
# wagtail | |
from wagtail.utils.widgets import WidgetWithScript | |
from wagtail.wagtailcore import blocks |
This file contains hidden or 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
cd somewhere | |
git clone https://github.com/[OWNER]/[REPO].git --branch [SPECIFIC BRANCH] --single-branch | |
cd [REPO] | |
python setup.py develop | |
# Usually, restart dev server to prevent it using already loaded site-packages modules. | |
# Hack away on code in [REPO], python will use this one rather than the one in site-packages. | |
# When done, to switch back: | |
python setup.py develop --uninstall | |
cd .. | |
rm -rf [REPO] |
This is an answer to https://twitter.com/tinkeraway/status/701746408072855552:
Calling npm run foo -- [something]
just calls whatever is defined under the foo
script and adds [something]
to the end.
So if you have this in your scripts
:
{
"foo": "webpack"
}
This file contains hidden or 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.serializers.json import DjangoJSONEncoder | |
from django.template import Library | |
from json import dumps as json_dumps | |
register = Library() | |
@register.filter | |
def json(data): | |
""" |
This file contains hidden or 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
/* | |
Based on code by Kevin Lamping | |
source: http://codepen.io/klamping/pen/waMOeX | |
*/ | |
@mixin flex-grid { | |
display: flex; | |
flex-wrap: wrap; | |
margin-left: -$gutter; | |
margin-top: -$gutter; |
This file contains hidden or 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
{"DD": [{"description": "Macintosh file archive", "used_by": "DISKDOUBLER"}], "CHZ": [{"description": "Archive", "used_by": "CHARC"}], "EUI": [{"description": "Ensoniq EPS family CD image", "used_by": "AWAVE"}], "INI": [{"description": "Initialization file", "used_by": ""}], "CHI": [{"description": "ChiWriter Document", "used_by": "ChiWriter - Chiview"}], "OCT": [{"description": "Musical file", "used_by": "Pctalizer"}], "GFO": [{"description": "SGI Radiosity", "used_by": ""}], "QVD": [{"description": "QlikView Document (Data)", "used_by": "QlikView Compressed Database File"}], "MCW": [{"description": "Text file", "used_by": "MacWrite II"}], "HI": [{"description": "Game high scores table", "used_by": ""}], "ZUR": [{"description": "High level compressed file", "used_by": ""}], "FPU": [{"description": "Configuration file", "used_by": "FoxPro for Unix"}], "F": [{"description": "Archive", "used_by": "FREEZE"}, {"description": "Forth language source code file", "used_by": "Forth development systems"}, {"description |
This file contains hidden or 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.utils import timezone | |
from wagtail.wagtailsearch.backends.elasticsearch import ElasticSearch, ElasticSearchQuery | |
from wagtail.wagtailcore.models import Page | |
from wagtail.wagtailimages.models import AbstractImage | |
from wagtail.wagtaildocs.models import Document | |
class ElasticSearchQueryWithRecency(ElasticSearchQuery): |
This file contains hidden or 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 import template | |
from django.template import Context | |
from django.template.base import parse_bits | |
from wagtail.wagtailimages.templatetags.wagtailimages_tags import ImageNode | |
from wagtail.wagtailimages.models import Filter, SourceImageIOError, InvalidFilterSpecError | |
from britishswimming.utils.models import SocialMediaSettings | |
register = template.Library() |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
,elem.offsetTop
,elem.offsetWidth
,elem.offsetHeight
,elem.offsetParent