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
var Spam = function() { | |
// some construction... | |
}; | |
Spam.prototype = { | |
// タイマーセットするメソッド | |
egg: function() { | |
var $_ = this; | |
setInterval(function() { | |
// 実際行いたい処理 |
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
import logging | |
from jinja2 import BytecodeCache | |
from redis import Redis | |
class RedisBytecodeCache(BytecodeCache): | |
"""bytecode cache on redis for jinja2 | |
""" | |
def __init__(self, host='localhost', port=6379, db=0, expire=0): | |
self._conn = Redis(host=host, port=port, db=db) |
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
# vim: fileencoding=utf-8 : | |
from werkzeug.contrib.sessions import SessionMiddleware | |
from sessions import RedisSessionStore | |
def create_application(): | |
app = Application() | |
app = SessionMiddleware(app, RedisSessionStore()) |
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
(function ($) { | |
$.fn.mixi = function () { | |
var buildQueries = function (params) { | |
var queries = []; | |
for (var i = 0, n = 0; i < params.length;) { | |
var key = params[i++]; | |
var value = params[i++]; | |
if (!value) continue; | |
queries[n++] = key + "=" + encodeURIComponent(value); |
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
// boot default server. | |
( | |
s = Server.default; | |
s.boot; | |
); | |
// define synth. | |
( | |
SynthDef("a", {|freq=440, amp=1, pan=0| |
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
{t=124;b=t/15;Pan2.ar(LFSaw.ar(Latch.ar(WhiteNoise.ar(24,39).midicps,Impulse.ar(b)),0,0.25),LFNoise0.ar(b))}.play |
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
#!/usr/bin/env python | |
# vim: fileencoding=utf-8 : | |
from CGIHTTPServer import test, CGIHTTPRequestHandler as BaseRequestHandler | |
class CGIHTTPRequestHandler(BaseRequestHandler): | |
def is_cgi(self): | |
path = self.path | |
if path.endswith('.py'): | |
try: |
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
# vim: filetype=nginx : | |
# this line required. | |
daemon off; | |
(snip...) |
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
# import logging module. | |
import logging | |
# get default logger. | |
logger = logging.getLogger() | |
# set logging level. | |
# valid level is CRITICAL(FATAL), ERROR, WARNING(WARN), INFO and DEBUG. | |
logger.setLevel(logging.DEBUG) |
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
$ pwd | |
/usr/local/src | |
$ curl -O http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz | |
$ tar zxf ./Imaging-1.1.7.tar.gz | |
cd Imaging-1.1.7 | |
$ ARCHFLAGS="-arch x86_64 -arch i386" python setup.py build |