Skip to content

Instantly share code, notes, and snippets.

@ProximaMonkey
ProximaMonkey / gist:2336255
Created April 8, 2012 09:30 — forked from huacnlee/gist:1150933
redis-search 0.3 Benchmark, 用户昵称搜索(10个字以内)
redis-search 0.3 Benchmark
Core 2 Duo CPU 2.66G, 4G Memory
20W 数据
# coding: utf-8
require "benchmark"
["的","美丽","云","云儿","花","云儿的"].each do |key|
# NOTE: This code was extracted from a larger class and has not been
# tested in this form. Caveat emptor.
import django.conf
import django.contrib.auth
import django.core.handlers.wsgi
import django.db
import django.utils.importlib
import httplib
import json
import logging
@ProximaMonkey
ProximaMonkey / tornado_static.py
Created April 13, 2012 07:31 — forked from peterbe/tornado_static.py
tornado_static
"""
tornado_static is a module for displaying static resources in a Tornado web
application.
It can take care of merging, compressing and giving URLs ideal renamings
suitable for aggressive HTTP caching.
(c) [email protected]
"""
@ProximaMonkey
ProximaMonkey / ses.py
Created April 13, 2012 07:33 — forked from fanzeyi/ses.py
session for tornado
import os
import uuid
import marshal
import binascii
import tornado.web
def Session(func):
def warpper(self, *args, **kwargs):
@ProximaMonkey
ProximaMonkey / forms.html
Created April 13, 2012 07:33 — forked from gnunicorn/forms.html
Jinja2 WTForms macros for twitter bootstrap
{%- macro form_field_label(field) -%}
<label for="{{ field.id }}">{{ field.label.text }}
{%- if field.flags.required -%}
<abbr title="Diese Feld muss angegeben werden">*</abbr>
{%- endif %}</label>
{% endmacro %}
{%- macro form_field_description(field) -%}
{% if field.description %}
<span class="descr">{{ field.description }}</span>
@ProximaMonkey
ProximaMonkey / phonegap.html
Created April 13, 2012 07:34 — forked from pamelafox/phonegap.html
Phonegap Index (Jinja2)
<!doctype html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>everyday.io</title>
{% if g and g.debug %}
<link rel="stylesheet" href="css/colorslider.css" />
<link rel="stylesheet" href="css/dateinput.css" />
<link rel="stylesheet" href="css/bootstrap-1.3.0.min.css">
@ProximaMonkey
ProximaMonkey / letter_renderer.py
Created April 13, 2012 07:37
Jinja2 letter template example
#!/usr/bin/env python
#encoding=utf-8
"""
Seth Brown
Python 3.2
Blog post link: http://j.mp/H5Zrdn
"""
import os, sys, csv
from glob import iglob
from subprocess import Popen, PIPE
@ProximaMonkey
ProximaMonkey / log.html
Created April 13, 2012 07:38 — forked from pamelafox/log.html
Jinja2 Template Example (Everyday.io Log)
{% extends "yourbase.html" %}
{% block subheader %}
<div class="page-header">
<h1>
<span id="log-date">{{ title }}</span>
<a data-tooltip="Change the date" id="log-date-button" href="javascript:void(0);" style="margin-left: 10px;"><img src="img/calendar.png"></a>
</h1>
</div>
{% endblock %}
@ProximaMonkey
ProximaMonkey / gist:2374918
Created April 13, 2012 07:40 — forked from cdragos/gist:2299991
Bootstrap jQuery plugin for creating confirmation dialogs with deferred chainable callbacks and Mustache templates.
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet" />
<title>Bootstrap modal confirm</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
@ProximaMonkey
ProximaMonkey / remote-typeahead.js
Created April 13, 2012 11:05 — forked from geuis/remote-typeahead.js
Remote data querying for Twitter Bootstrap 2.0 Typeahead without modifications
<script>
// Charles Lawrence - Feb 16, 2012. Free to use and modify. Please attribute back to @geuis if you find this useful
// Twitter Bootstrap Typeahead doesn't support remote data querying. This is an expected feature in the future. In the meantime, others have submitted patches to the core bootstrap component that allow it.
// The following will allow remote autocompletes *without* modifying any officially released core code.
// If others find ways to improve this, please share.
var autocomplete = $('#searchinput').typeahead()
.on('keyup', function(ev){
ev.stopPropagation();