Created by Christopher Manning
from django.contrib.sessions.backends.base import SessionBase, CreateError | |
from django.conf import settings | |
from django.utils.encoding import force_unicode | |
import redis | |
class SessionStore(SessionBase): | |
""" Redis store for sessions""" | |
def __init__(self, session_key=None): | |
self.redis = redis.Redis( |
function GetRFC822Date(oDate){ | |
// allow for empty request | |
if(typeof(oDate) == "undefined" || !oDate) oDate = new Date(); | |
//Pads numbers with a preceding 0 if the number is less than 10. | |
var LZ = function(val){ return (parseInt(val) < 10) ? "0" + val : val; } | |
/* accepts the client's time zone offset from GMT in minutes as a parameter. returns the timezone offset in the format [+|-}DDDD */ | |
var getTZOString = function(timezoneOffset){ |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
# Install MacTex: http://mirror.ctan.org/systems/mac/mactex/mactex-basic.pkg | |
$ sudo chown -R `whoami` /usr/local/texlive | |
$ tlmgr update --self | |
$ tlmgr install ucs | |
$ tlmgr install etoolbox | |
# Install pandoc view homebrew |
Create a Meteor app and put the client_/server_ files in a client/server directories. Also, create a public dir to save the uploaded files.
# Building static nginx for teh lulz | |
# | |
# basic dependencies | |
sudo apt-get install libxslt1-dev libxml2-dev zlib1g-dev libpcre3-dev libbz2-dev libssl-dev | |
# download nginx and openssl | |
wget http://nginx.org/download/nginx-1.5.6.tar.gz | |
tar xf nginx-1.5.6.tar.gz; cd nginx-1.5.6 |
There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.
So, these are the different settings we are going to compare:
- Go HTTP standalone (as the control group)
- Nginx proxy to Go HTTP
- Nginx fastcgi to Go TCP FastCGI
- Nginx fastcgi to Go Unix Socket FastCGI
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
// please comment if you know of other BOOKS (not considering blogs just yet) on ES6 that are out or coming out
- Understanding ECMAScript 6 -- Nicholas Zakas
- Exploring ES6 -- Axel Rauschmayer
- YDKJS: ES6 & Beyond -- Kyle Simpson
- JS.next: A Manager's Guide -- Aaron Frost
- Expert JavaScript -- Mark E. Daggett
- JavaScript Allongé, The "Six" Edition -- Reginald Braithwaite
- Learning ECMAScript 6 -- Narayan Prusty