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
from django import template | |
import re | |
register = template.Library() | |
@register.simple_tag | |
def youtube_embed(video): | |
YOUTUBE_REGEX = r'(https?://)?(www\.)?(youtube|youtu|youtube-nocookie)\.(com|be)/(watch\?v=|embed/|v/|.+\?v=)?([^&=%\?]{11})' | |
def _get_id(video): |
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
jQuery File Uploader (blueimp) and nginx benchmark notes. | |
Hypothesis: | |
Assigning the chunk size to be greater than the client_body_buffer_size will result in slower uploads and corrupt files. | |
Table 1: Stability | |
------------------ | |
The table below shows the number of successful file uploads after a random number of pause and resume operations. |
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
/* | |
* You can easily attach Backstretch to jQuery events, like click | |
* | |
* Click the buttons above to see the background image change | |
*/ | |
$("#outside").click(function(e) { | |
e.preventDefault(); | |
$.backstretch('images/outside.jpg'); | |
}); |
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
# | |
# Wide-open CORS config for nginx | |
# | |
location / { | |
if ($request_method = 'OPTIONS') { | |
add_header 'Access-Control-Allow-Origin' '*'; | |
# |
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
#!/bin/bash | |
VENV=$1 | |
if [ -z $VENV ]; then | |
echo "usage: runinenv [virtualenv_path] CMDS" | |
exit 1 | |
fi | |
. ${VENV}/bin/activate | |
shift 1 | |
echo "Executing $@ in ${VENV}" | |
exec "$@" |