Skip to content

Instantly share code, notes, and snippets.

server {
listen 80;
server_name konklone.com;
return 301 https://$host$request_uri;
}
# optional: the 'spdy' at the end of the listen command below turns on SPDY support.
server {
listen 443 ssl spdy;
# create stub, then run flask app in tornado on port 5000 (perhaps with supervisord config below http://supervisord.org/index.html)
#!/usr/bin/env python
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from myflaskapp import app
http_server = HTTPServer(WSGIContainer(app))
@gene9
gene9 / minimial-cedet-config.el
Created October 31, 2012 02:56 — forked from alexott/minimial-cedet-config.el
Working configuration for CEDET from bzr & GNU Emacs (with working C++ & Java name completion)
;;; minimial-cedet-config.el --- Working configuration for CEDET from bzr
;; Copyright (C) Alex Ott
;;
;; Author: Alex Ott <alexott@gmail.com>
;; Keywords: cedet, C++, Java
;; Requirements: CEDET from bzr (http://cedet.sourceforge.net/bzr-repo.shtml)
;; Do checkout of fresh CEDET, and use this config (don't forget to change path below)
@gene9
gene9 / clojure-match.clj
Created September 4, 2012 20:38 — forked from ckirkendall/clojure-match.clj
Language Compare F#, Ocaml, Scala, Clojure, Ruby and Haskell - Simple AST example
(use '[clojure.core.match :only [match]])
(defn evaluate [env [sym x y]]
(match [sym]
['Number] x
['Add] (+ (evaluate env x) (evaluate env y))
['Multiply] (* (evaluate env x) (evaluate env y))
['Variable] (env x)))
(def environment {"a" 3, "b" 4, "c" 5})
@gene9
gene9 / gist:2931885
Created June 14, 2012 18:09 — forked from SamSaffron/gist:893878
mini orm
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Reflection.Emit;
using System.Collections.Concurrent;
using System.Data;
using System.Reflection;
@gene9
gene9 / gist:2714357
Created May 16, 2012 22:06 — forked from mikeyk/gist:1329319
Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
@gene9
gene9 / model_localized_classmethod.py
Created May 14, 2012 13:32 — forked from acdha/model_localized_classmethod.py
Using @simonw's django-queryset-transform to avoid massive performance penalties with translated model content
@classmethod
def localized(cls, lang=u'en'):
"""
Returns a QuerySet which will be pre-populated with localized values
Usage:
Item.localized("en").filter(…)
"""
if not isinstance(lang, Language):
lang = Language.objects.get(iso639_3=lang)
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
D:\as\projects\test>lein plugin install lein-noir 1.2.1
[INFO] Unable to find resource 'lein-noir:lein-noir:jar:1.2.1' in repository cen
tral (http://repo1.maven.org/maven2)
Copying 1 file to c:\tmp\lein-57e6bf6f-bbab-4035-9060-b310b0ae1cb4\lib
Including lein-noir-1.2.1.jar
Including clojure-1.2.1.jar
Exception in thread "main" java.io.IOException: Couldn't delete c:\tmp\lein-57e6
@gene9
gene9 / example.js
Created February 27, 2012 10:01 — forked from addyosmani/example.js
Mediator pattern
// Example 1
mediator.name = 'Doug';
mediator.subscribe('nameChange', function(arg){
console.log(this.name);
this.name = arg;
console.log(this.name);
});
madiator.publish('nameChange', 'Jorn');
@gene9
gene9 / pubsub.md
Created February 27, 2012 09:59 — forked from addyosmani/pubsub.md
Four ways to do Pub/Sub with jQuery 1.7 and jQuery UI (in the future)

#Four Ways To Do Pub/Sub With jQuery 1.7 and jQuery UI (in the future)

Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.

(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)

##Option 1: Using jQuery 1.7's $.Callbacks() feature:

$.Callbacks are a multi-purpose callbacks list object which can be used as a base layer to build new functionality including simple publish/subscribe systems. We haven't yet released the API documentation for this feature just yet, but for more information on it (including lots of examples), see my post on $.Callbacks() here: