Skip to content

Instantly share code, notes, and snippets.

{
"files": [
{
"source": "js/prefix",
"kind": "core",
"type": "js",
"package": 0
},
{
"source": "js/fquery",
Online Builder, Basis and Full version
al-init $element
al-model - proxy for al-value, al-focused, al-checked ...
optional A2 style for events and directives
$global namespace
package main
import (
"fmt"
"runtime"
)
func green(k int) {
var i = 0;
for {
from sqlalchemy import *
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
engine = create_engine(connection_args)
metadata = MetaData(bind=engine)
class Tblname(Base):
__table__ = Table('tblname', metadata, autoload=True)
@lega911
lega911 / 0_result
Last active February 3, 2018 21:46
-O3
* C: 100% (~1.14sec)
* C++: 99.73%
* C++ exception: 84.6%
-O2
* C: 100% (~2.12sec)
* C++: 100.51%
* C++ exception: 74.02%
class Connect(object):
def describe(self):
return some_code2(self)
def check(self):
r = self.describe()
return some_code3(self, r)
def find(self):
r = some_code1(self)
{
# comments are useful
# specify rate in requests/second
"rate": 1000
// maybe you prefer js style comments
/* or if you feel old fashioned */
# key names do not need to be placed in quotes
key: "value"
7a8,9
> import hashlib
>
48a51
> self.lcache = {}
449c452
< return json.dumps({'id': identifier, 'results': _definitions})
---
> return json.dumps(_definitions)
560,565c563,584
Type Trial 1 Trial 2 Trial 3
%: 0.273233943000 0.268914790000 0.273714235000
str.format(): 0.7942503730000681 0.793637686999773 0.7926878570001463
str.Template(): 3.3321329630002765 3.3256752329998562 3.315622544999769
f-string: 0.1914799450000828 0.18900782099990465 0.19004946999984895
@lega911
lega911 / example.py
Created August 30, 2018 01:48
run callback on stop loop
import asyncio
async def main():
print('start')
async def on_stop():
try:
await asyncio.sleep(10**10)
except asyncio.CancelledError:
pass