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 SmartFormatMixin(object): | |
""" | |
A mixin to inherit from a model so it will have a common helper | |
methods to manage image formats. | |
""" | |
def media_format(self, mediafile): | |
""" | |
Common method to perform a naive check about image format using file | |
extension. |
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
""" | |
Attempt to parse breakpoints to compare them in pixels | |
""" | |
from collections import OrderedDict | |
base_font_size = 16 | |
base_font_unit = "px" |
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
""" | |
i18n utilities for our search app | |
""" | |
from django.conf import settings | |
def get_best_field_language(multilingual_field, best_language): | |
""" | |
Pick the best available language from a multilingual field. |
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
/* | |
* Placeholder is not able to reference parent selector name like | |
* '&__something' but does not write anything if no selector extends it | |
*/ | |
.bar, .foo { | |
color: red; | |
font-size: 1rem; | |
} | |
.title.bar, .title.foo { | |
content: ">"; |
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($) { | |
/* | |
* Initialize Foundation | |
*/ | |
$(document).foundation(); | |
/* | |
* Trick to automatically open drilldown menu directly on the current page panel. | |
* This is recursive, due to drilldown mechanics, it needs to open all sub menu | |
* to reach item. |
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 -*- | |
""" | |
Given a string of Sass color variables, output Sass variables for palette, | |
color scheme models and Python list | |
""" | |
import io | |
COLORS_STRING = u""" | |
$black: #000000; | |
$white: #ffffff; |
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
""" | |
A simple script to check about sources paths contained in a | |
listing file. | |
Listing file contains a path on each line, path should be absolute and will | |
be checked with os.path.exists. | |
Once finished, script will output first the validated file path list then |
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
/* | |
* Content to reveal on click with 'content-revealer' plugin | |
*/ | |
.content-to-reveal{ | |
display: 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
# -*- coding: utf-8 -*- | |
import os, io | |
# Some HTML template to produce for Django to list images | |
ALBUM_TPL = u"""<div class="item"> | |
<img src="{{% static 'images/album/{thumb}' %}}" | |
alt="{name}"> | |
</div> | |
""" |
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
/* | |
* Pure CSS spinner, taken from: | |
* https://stephanwagner.me/only-css-loading-spinner | |
* | |
* You may also see: | |
* https://github.com/loadingio/loading.css | |
*/ | |
@keyframes spinner { | |
to {transform: rotate(360deg);} | |
} |