Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
- John Woods (Most probably)
| from django.template import Library | |
| from django import template | |
| from app import settings | |
| register = Library() | |
| @register.tag | |
| def ifappexists(parser, token): | |
| """ Conditional Django template tag to check if one or more apps exist. |
| var inject_binding = function (allBindings, key, value) { | |
| //https://github.com/knockout/knockout/pull/932#issuecomment-26547528 | |
| return { | |
| has: function (bindingKey) { | |
| return (bindingKey == key) || allBindings.has(bindingKey); | |
| }, | |
| get: function (bindingKey) { | |
| var binding = allBindings.get(bindingKey); | |
| if (bindingKey == key) { | |
| binding = binding ? [].concat(binding, value) : value; |
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
| #!/usr/bin/env python | |
| import glob | |
| import os | |
| import sys | |
| # git usurbs your bin path for hooks and will always run system python | |
| site_packages = glob.glob('%s/lib/*/site-packages' % os.environ['VIRTUAL_ENV'])[0] | |
| sys.path.insert(0, site_packages) |
| # good balance between details and readability : https://bbs.archlinux.org/viewtopic.php?pid=1491879#p1491879 #archlinux | |
| # vim /etc/pacman.conf | |
| # XferCommand = echo Downloading %u ... && /usr/bin/aria2c --conf-path=/root/.aria2/pacman-aria2.conf %u | |
| # /root/.aria2/pacman-aria2.conf | |
| connect-timeout=30 | |
| max-tries=5 | |
| retry-wait=10 |
| #!/bin/bash | |
| # Copyright (c) 2011 Josh Schreuder | |
| # http://www.postteenageliving.com | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy | |
| # of this software and associated documentation files (the "Software"), to deal | |
| # in the Software without restriction, including without limitation the rights | |
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| # copies of the Software, and to permit persons to whom the Software is | |
| # furnished to do so, subject to the following conditions: |
| {% load i18n %} | |
| {% if is_paginated %} | |
| <nav aria-label="navigation" class="p-3"> | |
| <ul class="pagination"> | |
| {% if page_obj.has_previous %} | |
| <li class="page-item"> | |
| <a href="?{{ page_obj.previous_page_number.querystring }}" | |
| class="page-link previous">‹‹ {% trans "Previous" %}</a> | |
| </li> | |
| {% else %} |
| {% load i18n %} | |
| {% if is_paginated %} | |
| <nav aria-label="navigation" class="p-3"> | |
| <ul class="pagination"> | |
| {% if page_obj.has_previous %} | |
| <li class="page-item"> | |
| <a href="?page={{ page_obj.previous_page_number }}" aria-label="Previous" class="page-link previous"> | |
| ‹‹ {% trans "Previous" %} | |
| </a> | |
| </li> |
| #!/bin/sh | |
| echo | |
| exec /usr/bin/uptime |