Skip to content

Instantly share code, notes, and snippets.

Eric Reynolds ericremoreynolds

Block or report user

Report or block ericremoreynolds

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ericremoreynolds
ericremoreynolds / bisect_key.py
Last active Mar 5, 2019
Key-like functionality recipe for Python's bisect functions
View bisect_key.py
class KeyifyList(object):
def __init__(self, inner, key):
self.inner = inner
self.key = key
def __len__(self):
return len(self.inner)
def __getitem__(self, k):
return self.key(self.inner[k])
@ericremoreynolds
ericremoreynolds / client.html
Last active Nov 12, 2019
Flask-socket.io emit to specific clients
View client.html
<html>
<body>
<h1>I feel lonely</h1>
<script type="text/javascript" src="//code.jquery.com/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js"></script>
<script type="text/javascript" charset="utf-8">
var socket = io.connect('http://' + document.domain + ':' + location.port);
socket.on('connect', function() {
socket.emit('connected');
You can’t perform that action at this time.