Skip to content

Instantly share code, notes, and snippets.

View kurap's full-sized avatar

TetsuyaKurata kurap

View GitHub Profile
@joanfont
joanfont / youtube.py
Created February 1, 2015 11:52
Django YouTube embed tag
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):
@JAndritsch
JAndritsch / results.txt
Last active February 3, 2023 07:46
Nginx settings and jQuery File Uploader chunk sizes
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.
@srobbin
srobbin / gist:1978737
Last active March 25, 2018 13:01
Backstretch Demo: Button Click
/*
* 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');
});
@michiel
michiel / cors-nginx.conf
Created July 5, 2011 10:41
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
@parente
parente / runinenv.sh
Created February 15, 2011 01:54
run a command in virtualenv, useful for supervisord
#!/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 "$@"