This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl -XGET 'http://localhost:9200/user1/docs/_search?q=docs.path:*' | |
{ | |
"_shards": { | |
"failed": 0, | |
"successful": 5, | |
"total": 5 | |
}, | |
"hits": { | |
"hits": [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | |
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title></title> | |
<meta name="description" content=""> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
InetAddress group = InetAddress.getByName("228.5.6.7"); | |
MulticastSocket s = new MulticastSocket(6789); | |
s.joinGroup(group); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A(object): | |
class_attribute = 1 | |
def __init__(self): | |
self.instance_attribute = 2 | |
class B(A): | |
def test1(self): | |
print super(B, self).class_attribute | |
def test2(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nose.core | |
import unittest | |
runner = nose.core.TextTestRunner() | |
# runner = unittest.TextTestRunner() # Does not work either | |
programm = nose.core.TestProgram(defaultTest='.', testRunner=runner, | |
argv=['nosetests'], exit=False) | |
# programm = nose.core.TestProgram(defaultTest='.', # This works | |
# argv=['nosetests'], exit=False) | |
print "Hello World !" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Come from excellent http://stefan.sofa-rockers.org/2012/02/01/designing-and-testing-pyzmq-applications-part-1/ | |
def stream(context, loop, sock_type, addr, bind, callback=None, subscribe=b'', | |
random=False): | |
""" | |
Creates a :class:`~zmq.eventloop.zmqstream.ZMQStream`. | |
:param sock_type: The ØMQ socket type (e.g. ``zmq.REQ``) | |
:param addr: Address to bind or connect to formatted as *host:port*, | |
*(host, port)* or *host* (bind to random port). | |
If *bind* is ``True``, *host* may be: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def __setattr__(self, index, value): | |
# Hack for properties setter | |
if hasattr(getattr(self.__class__, index, None), '__get__'): | |
return object.__setattr__(self, index, value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
class ListApiSet(object): | |
def __init__(self): | |
self.container = set() | |
def extend(self, value): | |
self.container.update(value) | |
return self.container |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from poc import TemplateTestCase, Call, template | |
def support_http_method(method): | |
if method in ('POST', 'GETT'): | |
return True | |
else: | |
return False | |
class SupportHttpMethodTestCase(unittest.TestCase): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from poc import TemplateTestCase, Call, template | |
def support_http_method(method): | |
if method in ('POST', 'GET'): | |
return True | |
else: | |
return False | |
class SupportHttpMethodTestCase(unittest.TestCase): |