Skip to content

Instantly share code, notes, and snippets.

View maxp's full-sized avatar

Maxim Penzin maxp

View GitHub Profile
.popup.left:before {
border-left: 10px solid #71653a;
border-top: 10px solid rgba(113, 101, 58, 0);
border-bottom: 10px solid rgba(113, 101, 58, 0);
right: -10px;
top: 20px;
}
.popup.left:after {
border-left: 10px solid #fff1be;
var yaml = require('js-yaml')
var bug = require('./issue-54.yaml')
console.log( bug[38] );
console.log( bug[39] );
console.log( bug[40] );
/*
(defn
^{:doc "mymax [xs+] gets the maximum value in xs using > "
:test (fn []
(assert (= 42 (mymax 2 42 5 4))))
:user/comment "this is the best fn ever!"}
mymax
([x] x)
([x y] (if (> x y) x y))
([x y & more]
(reduce mymax (mymax x y) more)))
import jinja2
import markdown
def safe_markdown(text):
return jinja2.Markup(markdown.markdown(text, ...))
env = jinja2.Environment(...)
env.filters['markdown'] = safe_markdown
cacheMiddleware = cacheMiddleware = (seconds) -> (req, res, next) ->
res.setHeader "Cache-Control", "public, max-age=#{seconds}"
next()
app.get "/recent", cacheMiddleware(5 * 60), (req, res, next) ->
#When someone hits /recent, nginx will cache it for 5 minutes!
/etc/sysctl.conf:
fs.file-nr = 1006336 0 1565787
fs.file-max = 1565787
net.core.rmem_max = 33554432
net.core.wmem_max = 33554432
net.ipv4.tcp_rmem = 4096 16384 33554432
net.ipv4.tcp_wmem = 4096 16384 33554432
net.ipv4.tcp_mem = 786432 1048576 26777216
# -*- coding: utf-8 -*-
"""
anga: weather.views
@author: maxp
"""
import logging; log = logging.getLogger(__name__)
import time
import random
# -*- coding: utf-8 -*-
"""
sokfor: user.middleware
"""
from django.http import HttpResponseRedirect
from . import APP_NAME
import logging
@maxp
maxp / json_encoder.py
Created July 9, 2012 04:24
jsond encoder/decoder - datetime, time, mongodb_id, default
import json
try:
from bson.objectid import ObjectId
except:
pass
class APIEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, (datetime.datetime, datetime.date)):
/*
http://www.alessioatzeni.com/meteocons/
*/
@font-face {
font-family: 'MeteoconsRegular';
src: url('meteocons-webfont.eot');
src: url('meteocons-webfont.eot?#iefix') format('embedded-opentype'),
url('meteocons-webfont.woff') format('woff'),