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
pixelToPoint = function(point, zoom, center, bounds) { | |
// 像素到坐标 | |
if (!point) { | |
return | |
} | |
var zoomUnits = getZoomUnits(zoom); | |
var mercatorLng = center.lng + zoomUnits * (point.x - bounds.width / 2); | |
var mercatorLat = center.lat - zoomUnits * (point.y - bounds.height / 2); | |
var mercatorLngLat = {lng: mercatorLng, lat: mercatorLat}; | |
return mercatorToLngLat(mercatorLngLat) |
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 dis, marshal, struct, sys, time, types | |
def show_file(fname): | |
f = open(fname, "rb") | |
magic = f.read(4) | |
moddate = f.read(4) | |
modtime = time.asctime(time.localtime(struct.unpack('L', moddate)[0])) | |
print "magic %s" % (magic.encode('hex')) | |
print "moddate %s (%s)" % (moddate.encode('hex'), modtime) | |
code = marshal.load(f) |
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 marshal | |
import struct | |
import time | |
import imp | |
from opcode import opmap | |
def f(): return | |
code = type(f.__code__) # the code object type | |
code_list = ( |
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 marshal | |
import struct | |
import time | |
import imp | |
from opcode import opmap | |
SEXPR = ('+', 1, | |
('-', 3, | |
('+', 1 , 1))) |
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
# coding: utf-8 | |
from pprint import pprint | |
RIGHT, DOWN, LEFT, UP = 1, 2, 3, 4 | |
class MatrixWalker(object): | |
def __init__(self, width): | |
self.width = width | |
x = width + 2 # 多一圈,作为最外圈的墙壁 |
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
VObject. Value ::= "{" [Item] "}" ; | |
ObjItem. Item ::= String ":" Value ; | |
separator Item "," ; | |
terminator Item "" ; | |
VArray. Value ::= "[" [Value] "]" ; | |
separator Value "," ; | |
terminator Value "" ; | |
VInt. Value ::= Integer ; |
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
(define bt (import "bottle")) | |
(define route (attr bt "route")) | |
(define (index) "Hello") | |
((route "/") | |
(@callable (lambda () | |
"Hello"))) | |
((attr bt "run")) |
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
using std; | |
using assert; | |
func main = ()=> int { | |
list<int> l = [0, 1, 2, 3, 4, 5]; | |
dict<char*, int> d = { | |
"one": 1, | |
"two": 2, | |
"tree": 3, | |
}; |
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
package main | |
const ( | |
MEMORY_SIZE = 100 | |
) | |
type State struct { | |
Instructions string | |
Memory []byte | |
Ip int |
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
# buildin functions | |
# add -> integer -> integer | |
add 1 2 # => 3 | |
# log -> nothing | |
log 1 | |
# variable assignment |
OlderNewer