Skip to content

Instantly share code, notes, and snippets.

timeit = function(fn) {
var a = (new Date()).valueOf();
fn();
console.log((new Date()).valueOf() - a);
}
this.renderWithJS = function() {
timeit(function() {
var d = ['<ul class="list-group">'];
var i, user;
import timeit
import threading
def lf(lst):
for i in range(10000):
lst.append(i)
def f1():
lst = []
lf(lst)
import timeit
import threading
def lf(lst):
for i in range(10000):
lst.append(i)
def f1():
lst = []
lf(lst)
import timeit
import threading
lst = []
def lf():
for i in range(10000):
lst.append(i)
def f1():
import timeit
import threading
lst = []
def lf():
del lst[:]
for i in range(10000):
lst.append(i)
import threading
import time
from contextlib import contextmanager
@contextmanager
def timeit(exception=Exception):
start = time.time()
yield
print(time.time() - start)
alight.directives.al.submit2 = function() {
var dir = alight.directives.al.submit.apply(null, arguments); // Создаем родительскую директиву
dir.doCallback = function(e) { // Подменяем метод обновления модели
self.callback();
scope.$scan();
return true;
};
return dir;
}
import os
import bottle
os.chdir(os.path.dirname(os.path.abspath(__file__)))
@bottle.route('/')
def index():
return b'Hello world'
application = bottle.default_app()
curl -X PUT 10.0.3.16:9200/btest -d '
{
"settings" : {
"index" : {
"analysis" : {
"analyzer" : {
"my_analyzer" : {
"type" : "custom",
"tokenizer" : "lowercase",
"filter" : ["my_ngram"]
from eps_get import EPS
import core, app # load app
import sys
def call_eps(name):
EPS.system.start()
fn = EPS
for k in name.split('.')[1:]: