A list of comman regular expressions for use in django url's regex.
Example Django URLs patterns:
urlpatterns = patterns('',
<form id="contact-form" action="//formspree.io/your@email.com" method="post"> | |
<input type="text" name="Name" placeholder="Name" required> | |
<input type="email" name="Email" placeholder="Email" required> | |
<textarea name="Message" cols="30" rows="6" placeholder="Message" required></textarea> | |
<!-- CONFIG --> | |
<input class="hidden" type="text" name="_gotcha"> | |
<input type="hidden" name="_subject" value="Email Subject"> | |
<!-- /CONFIG --> | |
<input class="submit" type="submit" value="Send message"> | |
</form> |
$("#action-button").click(function() { | |
// supondo que voce tenha um <input id="pesquisar-nome"/> | |
var inputValue = $("#pesquisar-nome").val(); | |
$.ajax({ | |
url: "/search_view/?pesquisar-nome=" + encodeURIComponent(inputValue), | |
type: "get", | |
success: function(data) { | |
$('#results').html(data); | |
} | |
}); |
# Sample i2of5 barcode generation. | |
from reportlab.pdfgen import canvas | |
from reportlab.lib.pagesizes import A4 | |
from reportlab.lib.units import mm | |
from reportlab.graphics.barcode.common import I2of5 | |
c=canvas.Canvas("barcode_example.pdf",pagesize=A4) | |
tb=0.254320987654 * mm # thin bar | |
bh=20 * mm # bar height |
#!/bin/bash | |
NAME="hello_app" # Name of the application | |
DJANGODIR=/webapps/hello_django/hello # Django project directory | |
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket | |
USER=hello # the user to run as | |
GROUP=webapps # the group to run as | |
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn | |
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use | |
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name |
An explanation of JavaScript's pass-by-value, which is unlike pass-by-reference from other languages.
This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.
http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL
This is just some code I recently used in my development application in order to add token-based authentication for my api-only rails app. The api-client was to be consumed by a mobile application, so I needed an authentication solution that would keep the user logged in indefinetly and the only way to do this was either using refresh tokens or sliding sessions.
I also needed a way to both blacklist and whitelist tokens based on a unique identifier (jti)
Before trying it out DIY, I considered using: