Skip to content

Instantly share code, notes, and snippets.

View andreypopp's full-sized avatar
🏠
Working from home

Andrey Popp andreypopp

🏠
Working from home
View GitHub Profile
module.exports = {
plugins: [
new webpack.ResolverPlugin([
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin(
'bower.json', ['main'])
], ['normal'])
]
}
from gunicorn.app.base import Application
class MyApplication(Application):
def __init__(self, wsgi_app, **kw):
MyApplication.__init__(**kw)
self.callback = wsgi_app
from myapp import make_app
MyApplication(make_app()).run()
%%% @doc Basic utilities for working with ACLs over integer-based principals.
%%%
%%% @type acl() = [acl_entry()]
%%% @type acl_entry() =
%%% {allow, principal_qualifier()}
%%% | {deny, principal_qualifier()}
%%% @type principal_qualifier() =
%%% int()
%%% | any
%%% | {range, int(), int()}
flattened_list = [y for x in nested_list for y in x]
15449 andreypopp 36 44 0 1287M 329M ucond 10 31:41 1183.40% java
andreypopp> python -m timeit -v "range(40)[:len('string')]" ~
10 loops -> 1.41e-05 secs
100 loops -> 0.000143 secs
1000 loops -> 0.00119 secs
10000 loops -> 0.0117 secs
100000 loops -> 0.117 secs
1000000 loops -> 1.16 secs
raw times: 1.17 1.17 1.18
1000000 loops, best of 3: 1.17 usec per loop
andreypopp> python -m timeit -v "range(40)[:6]" ~
psql=# table b;
l │ r
───┼───
a │ b
b │ e
e │ d
(3 rows)
Time: 0.188 ms
psql=# with recursive c as (select * from b union select b.l, c.r from b join c on c.l = b.r) table c;
package ru.braintrace
class OptionParser {
private val optionInfo = new mutable.ListBuffer[OptionInfo]
def addOption(option: OptionInfo) =
optionInfo.append(option)
def addOption(short: String, long: String): Unit =
from imagination.actors import Actor, react
class MyActor(Actor):
@react({"a": str, "b": [int]})
def process_message(self, message):
pass
case req @ DELETE(Path(Seg("users" :: name :: "bookmarks" :: uri))) => for {
BasicAuth(u, p) <- req
UserFound(user) if verify(u, p, user) <- userRepository.findByName(name)
Success <- user.bookmarks.remove(uriString)
} yield NoContent