Skip to content

Instantly share code, notes, and snippets.

@st4lk
st4lk / django_log_settings.py
Last active December 2, 2022 07:14
Django logging settings
# Logging settings for django projects, works with django 1.5+
# If DEBUG=True, all logs (including django logs) will be
# written to console and to debug_file.
# If DEBUG=False, logs with level INFO or higher will be
# saved to production_file.
# Logging usage:
# import logging
# logger = logging.getLogger(__name__)
# logger.info("Log this message")
/**
* 引用不同的数据,会得到不同的地图切片
* 卫星(无地标) WGS-84 一般 GCJ-02
* <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
* 卫星(有地标) GCJ-02 一般 GCJ-02
* <script src="https://ditu.google.cn/maps/api/js?v=3.exp&sensor=false"></script>
*/
(function (map) {
var Converter = function () {
@sgonyea
sgonyea / infinite_cache.py
Created July 18, 2012 03:28
Infinite Cache: Python vs. Ruby
# In Python:
from collections import defaultdict
def infinite_cache():
cache = lambda: defaultdict(cache)
return cache()
cache = infinite_cache()