Skip to content

Instantly share code, notes, and snippets.

from strategies import store
@store
def name0():
pass
@store
def name1():
@purpleP
purpleP / results.txt
Created January 5, 2017 14:04
comparing different string search methods
----------------------------------------------------------------------------------- benchmark: 3 tests -----------------------------------------------------------------------------------
Name (time in us) Min Max Mean StdDev Median IQR Outliers(*) Rounds Iterations
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_search[re_compile] 452.1870 (1.0) 1,199.2530 (1.13) 471.1449 (1.0) 56.5338 (1.0) 455.0175 (1.0) 3.9840 (1.0) 120;321 1844 1
test_search[no_compile] 521.2920 (1.15) 1,059.7880 (1.0) 554.4658 (1.18) 92.9603 (1.64) 526.5430 (1.16) 5.2185 (1.31) 28;75 388 1
test_search[endswith] 1,601.1760 (3.54) 3,252.0090 (3.07) 1,691.4124 (3.59) 246.1582
@purpleP
purpleP / lessparens.py
Last active December 21, 2016 20:30
What if python have parens in function calls optional where possible?
def some(a, b, c):
print a, b, c
def foo(a, b):
return a, b
def bar():
print 'bar'
@purpleP
purpleP / snippets
Created May 24, 2016 21:03
some python snippets for ultisnip
snippet fixture "pytest fixture" b
@pytest.fixture(${1})
def ${2}(${3}):
${4}
endsnippet
snippet parametrize "pytest parametrize test" b
@pytest.mark.parametrize(${1:''}, ${2:()})
def ${3}(${4}):
${5}
from pytest import fixture, mark
from sqlalchemy import (
create_engine,
Column,
String,
Integer,
ForeignKey
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
@purpleP
purpleP / designer.html
Last active August 29, 2015 14:12
designer
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@purpleP
purpleP / designer.html
Created December 20, 2014 10:21
designer
<link rel="import" href="../paper-button/paper-button.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@purpleP
purpleP / designer.html
Last active August 29, 2015 14:07
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../chart-js/chart-js.html">
<polymer-element name="my-element">