Skip to content

Instantly share code, notes, and snippets.

@mbildner
mbildner / _.md
Created March 13, 2013 00:51
Tributary inlet
"""
This is a simple example of WebSocket + Tornado + Redis Pub/Sub usage.
Do not forget to replace YOURSERVER by the correct value.
Keep in mind that you need the *very latest* version of your web browser.
You also need to add Jacob Kristhammar's websocket implementation to Tornado:
Grab it here:
http://gist.github.com/526746
Or clone my fork of Tornado with websocket included:
http://github.com/pelletier/tornado
Oh and the Pub/Sub protocol is only available in Redis 2.0.0:
@mbildner
mbildner / check_split
Last active December 20, 2015 07:49
Python program allowing multiple users to split a check by item, automatically updating their tax, tip, and total bill based on user preference.
"""
One of my first Desktop apps, this lets users split a check among several users. Just add each user, and the % amount they like to tip (eg: "Moshe Bildner, 16%"), add any foods on the bill, as well as their prices (the app comes preloaded with a sample dinner for two, but you can delete that and add your own), and assign each person the foods they are responsible for. The consequent personalized bills will be shown in the command line.
Commands:
Ctrl+Left-Click-drag: from a food to a person to assign responsibility to that person. Responsibility may be split among an unlimited number of people.
Left-Click-drag: move a food or person for easier viewing. Responsibility lines and the checks will be kept in sync.
@mbildner
mbildner / req_benchmark.py
Created October 22, 2013 15:25
Gevent is magic. Done.
import timeit
import grequests
import requests
def blocking_get():
url = "http://www.google.com"
@mbildner
mbildner / trequests.py
Created October 22, 2013 17:18
building a non-blocking requests tool on top of Requests and Twisted
from time import time
import requests
languages_list = [
"English",
"French",
"German",
"Swahili",
@mbildner
mbildner / rtc_demo_annotated.html
Created November 11, 2013 15:54
Annotated WebRTC intra-window data channel example. Based on: http://simpl.info/rtcdatachannel/js/main.js
<html>
<head>
<title></title>
<!-- based on http://simpl.info/rtcdatachannel/js/main.js -->
</head>
<body>
<textarea id="dataChannelSend"></textarea>
<textarea id="dataChannelReceive"></textarea>
<html>
<head>
<title></title>
</head>
<body>
<button id="startButton">Start</button>
<video id="remoteView" height="300" width="300" autoplay></video>
<html>
<head>
<style type="text/css">
path.link {
fill: none;
stroke: lime;
stroke-width: 2px;
}
circle {
@mbildner
mbildner / plus_overload
Created February 28, 2014 00:22
operator overloading js
<html>
<head>
<title></title>
</head>
<body>
<script>
function Person (first, last) {
this.first = first;
this.last = last;
<html ng-app="app">
<head>
<title>Datepicker</title>
</head>
<body>
<date-range-picker
startDate="04-15-1989"
endDate="06-12-2001"
>