by Ossi Hanhinen, @ohanhi
with the support of Futurice 💚.
Licensed under CC BY 4.0.
| from django.utils.safestring import mark_safe | |
| from markdown import markdown | |
| from pygments import highlight | |
| from pygments.formatters import get_formatter_by_name | |
| from pygments.lexers import get_lexer_by_name | |
| from wagtail.wagtailcore import blocks | |
| class CodeBlock(blocks.StructBlock): |
| var active = false; | |
| function changeRefer(details) { | |
| if (!active) return; | |
| for (var i = 0; i < details.requestHeaders.length; ++i) { | |
| if (details.requestHeaders[i].name === 'Referer') { | |
| details.requestHeaders[i].value = 'http://www.google.com/'; | |
| break; | |
| } |
| /* bling.js */ | |
| window.$ = document.querySelector.bind(document); | |
| window.$$ = document.querySelectorAll.bind(document); | |
| Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); }; | |
| NodeList.prototype.__proto__ = Array.prototype; | |
| NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); }; |
| * { | |
| font-size: 12pt; | |
| font-family: monospace; | |
| font-weight: normal; | |
| font-style: normal; | |
| text-decoration: none; | |
| color: black; | |
| cursor: default; | |
| } |
##Sass Functions Cheat Sheet
| {% block extra_js %} | |
| <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key={{ GOOGLE_MAPS_KEY }}"> </script> | |
| <script type="text/javascript"> | |
| var pages = []; | |
| {% for page in pages %} | |
| pages.push([ | |
| {{ page.location.latitude }}, | |
| {{ page.location.longitude }}, | |
| "{{ page.title }}", | |
| "{{ page.text }}" |
| class Locatable(models.Model): | |
| location_name = models.CharField( | |
| max_length=255, | |
| blank=True) | |
| location = models.ForeignKey( | |
| 'home.Location', | |
| null=True, | |
| blank=True, | |
| on_delete=models.SET_NULL, | |
| related_name='+', |