This file contains hidden or 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 | |
__author__ = 'AprocySanae' | |
class TreeNode(object): | |
def __init__(self, x): | |
self.val = x | |
self.left = None | |
self.right = None | |
def __str__(self): |
This file contains hidden or 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 time | |
from threading import Event | |
from queue import Queue | |
import threading | |
q1 = Queue() | |
q2 = Queue() | |
class H(object): | |
def __init__(self): |
This file contains hidden or 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
<div class="l-content"> | |
<div class="pricing-tables pure-g"> | |
<div class="pure-u-1 pure-u-md-1-4"> | |
<button type="button" class="button-success pure-button" onclick="test_start()">启动</button> | |
</div> | |
<div class="pure-u-1 pure-u-md-1-4"> | |
<button type="button" class="button-error pure-button" onclick="test_stop()">停止</button> | |
</div> |
This file contains hidden or 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
function createXHR(){ | |
if (typeof XMLHttpRequest != "undefined"){ | |
return new XMLHttpRequest(); | |
} | |
else { | |
throw new Error("No XHR object available"); | |
} | |
} |
This file contains hidden or 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 | |
__inspired__ = 'jimmyislive <https://github.com/jimmyislive/hg-pylint-commit-hook>' | |
__author__ = 'AprocySanae' | |
import os | |
import subprocess | |
from hgapi import hgapi | |
import re | |
from StringIO import StringIO |
This file contains hidden or 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 tornado.ioloop import IOLoop | |
import tornado.web | |
from tornado import gen | |
import time | |
import settings as Settings | |
class TestHandler(tornado.web.RequestHandler): | |
@gen.coroutine |
This file contains hidden or 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
<!DOCTYPE html> | |
<head> | |
<script type="text/javascript"> | |
var evtSrc = new EventSource("/test"); | |
evtSrc.onmessage = function(e) { | |
console.log(e.data); | |
}; | |
function send(){ | |
var xhr = new XMLHttpRequest(); |
This file contains hidden or 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
def func_environment(): | |
env = dict() | |
def symbol(identify, bp=0, auto_commit = True): | |
try: | |
s = env[identify] | |
except Exception: | |
class s(Token): | |
pass | |
if auto_commit: | |
s.__name__ = 'symbol-{}'.format(identify) |
This file contains hidden or 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
def line_resize(lines, width): | |
count = len(lines) | |
index = 0 | |
while index < count: | |
line = lines[index] | |
line_lenth = len(line) | |
if line_lenth > width: | |
s_width = 0 | |
while s_width < line_lenth: | |
yield line[s_width:s_width+width] |
This file contains hidden or 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
from BasePool import BasePool | |
class TaskPool(BasePool): | |
def __init__(self, *args, **kwargs): | |
from gevent import spawn_raw | |
from gevent.pool import Pool | |
self.Pool = Pool | |
super(TaskPool, self).__init__(*args, **kwargs) | |
def on_start(self): |
NewerOlder