- NodeBox - a nice lib to create images of graph networks
- Python Image Library
- BeautfulSoup - HTML parser
- mechanize - automated web browsing
| import codecs | |
| def unicode_safe_127(ss, debug=False): | |
| """safely handle strings with have ordinal values greater than 127 | |
| by escaping each value as appropriate. | |
| if debug=True, log each conversion to stderr | |
| """ | |
| mys = ss | |
| tos=[] | |
| for i,s in enumerate(mys): |
| ($=document.createElement('script')).src='http://j.mp/jqueryjs';(document.getElementsByTagName('head')[0]).appendChild($) |
Original discussion began on Twitter and can be found by starting here and here. Discussion was continued on es-discuss mailing list in the thread Pure win: Array.from and Array.of
Update Nov. 3, 2011
Official strawman has been posted: http://wiki.ecmascript.org/doku.php?id=strawman:array_extras
| from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler | |
| from SocketServer import ThreadingMixIn | |
| import threading | |
| import requests | |
| class Handler(BaseHTTPRequestHandler): | |
| def __init__(self, request, client_address, server): | |
| print "Init!" | |
| self.protocol_version = 'HTTP/1.1' | |
| BaseHTTPRequestHandler.__init__(self, request, client_address, server) #http://www.mlsite.net/blog/?p=80 |
Here's what I do after I do a fresh install of Lion. Things are sorta grouped by type.
| function chunk(a, s){ | |
| for(var x, i = 0, c = -1, l = a.length, n = []; i < l; i++) | |
| (x = i % s) ? n[c][x] = a[i] : n[++c] = [a[i]]; | |
| return n; | |
| } |
| function(key, values, rereduce) { | |
| Array.prototype.unique = function() { | |
| var a = []; | |
| var l = this.length; | |
| for(var i=0; i<l; i++) { | |
| for(var j=i+1; j<l; j++) { | |
| // If this[i] is found later in the array | |
| if (this[i] === this[j]) | |
| j = ++i; | |
| } |