---------- Forwarded message ----------
From: Mark S. Miller <[email protected]>
Date: Tue, Nov 16, 2010 at 3:44 PM
Subject: "Future of Javascript" doc from our internal "JavaScript Summit"
last week
To: [email protected]
| # Author: Pieter Noordhuis | |
| # Description: Simple demo to showcase Redis PubSub with EventMachine | |
| # | |
| # Update 7 Oct 2010: | |
| # - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
| # the WebSocket protocol implementation in the cramp gem does not work | |
| # well with Chrome's (newer) WebSocket implementation. | |
| # | |
| # Requirements: | |
| # - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
| import pdb | |
| """ | |
| The Bellman-Ford algorithm | |
| Graph API: | |
| iter(graph) gives all nodes | |
| iter(graph[u]) gives neighbours of u | |
| graph[u][v] gives weight of edge (u, v) | |
| """ |
| """Genetic Algorithmn Implementation | |
| see: | |
| http://www.obitko.com/tutorials/genetic-algorithms/ga-basic-description.php | |
| """ | |
| import random | |
| class GeneticAlgorithm(object): | |
| def __init__(self, genetics): | |
| self.genetics = genetics | |
| pass |
| # -*- coding:utf-8 -*- | |
| import urllib | |
| import urllib2 | |
| from BeautifulSoup import BeautifulSoup | |
| import re | |
| import os | |
| import zipfile | |
| """ |
---------- Forwarded message ----------
From: Mark S. Miller <[email protected]>
Date: Tue, Nov 16, 2010 at 3:44 PM
Subject: "Future of Javascript" doc from our internal "JavaScript Summit"
last week
To: [email protected]
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset=utf-8 /> | |
| <title>graph-vis</title> | |
| </head> | |
| <body> | |
| <canvas id="viewer" width="800" height="500"></canvas> | |
| <script src="graph-vis.js"></script> | |
| </body> |
| import redis | |
| import time | |
| import sys | |
| def producer(): | |
| r = redis.Redis() | |
| i = 0 | |
| while True: | |
| r.rpush('queue', 'Message %d' % i) |
| # Answer to a question on Flask mailing list | |
| # http://librelist.com/browser//flask/2012/6/30/using-ajax-with-flask/ | |
| # NOTE: *REALLY* don't do the thing with putting the HTML in a global | |
| # variable like I have, I just wanted to keep everything in one | |
| # file for the sake of completeness of answer. | |
| # It's generally a very bad way to do things :) | |
| # | |
| from flask import (Flask, request, jsonify) | |
| app = Flask(__name__) |
| #import <Foundation/Foundation.h> | |
| @interface KUtils : NSObject | |
| + (NSString *)getVersionInfo; | |
| @end |