Skip to content

Instantly share code, notes, and snippets.

@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">
@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:12
designer
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
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 / 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}
@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 / 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
from strategies import store
@store
def name0():
pass
@store
def name1():
@purpleP
purpleP / vim-tmux.md
Created January 29, 2017 00:37
How to run tests with tmux and vim

Running tests with vim and tmux

After using vim and neovim for almost a year now I've come to the point when frustration I had with running test with vim made me think about ideal workflow for running tests (at least in command line, but some rules apply to GUI).

Below you can read my thoughts about ideal workflow, a summary of problems with current workflows (at least that I know of, but I think I've tried them all) and my own new (well, at least I think it's new) solution to them.

@purpleP
purpleP / changes.hs
Created March 9, 2017 22:33
attempt at json serialization in haskell
{-# LANGUAGE DeriveGeneric, DeriveAnyClass, StandaloneDeriving #-}
import Data.Map (empty, fromList, insert, delete, Map)
import GHC.Generics
import Data.Aeson
import qualified Data.Text.Lazy.IO as T
import qualified Data.Text.Lazy.Encoding as T
data Task = Task
{ id :: String