This file contains hidden or 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
| <thead> | |
| <tr bgcolor="lightgray" class="header-row"> | |
| <th id="id" class="data-sort" >Id</th> | |
| <th id="date" class="data-sort" >Date</th> | |
| <th id="hourEnd" class="data-sort" >Hour</th> | |
| <th id="loadAvgHourlyDAY" class="data-sort" >Load</th> | |
| </tr> | |
| </thead> |
This file contains hidden or 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
| <table id="example-4" bgcolor="gray" class="grid-test"> | |
| <thead> | |
| <tr bgcolor="lightgray" class="header-row"> | |
| <th id="id" class="column" >Id</th> | |
| <th id="date" class="column" >Date</th> | |
| <th id="hourEnd" class="column" >Hour</th> | |
| <th id="loadAvgHourlyDAY" class="column" >Load</th> | |
| </tr> | |
| </thead> | |
| <tbody class="data-body"> |
This file contains hidden or 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
| ''' | |
| Usage: | |
| >python server.py PORT | |
| where PORT defaults 8000 | |
| Serves files from the current working directory | |
| ''' | |
| from SimpleHTTPServer import test as run | |
| if __name__ =='__main__': |
This file contains hidden or 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
| { | |
| "_id": "_design/erlang_reports", | |
| "_rev": "10-3d4e646c0990861c315e984056c397a7", | |
| "language": "erlang", | |
| "views": { | |
| "revisions": { | |
| "map": "fun({Doc}) ->\u000a <<K,_/binary>> = proplists:get_value(<<\"_rev\">>, Doc, null),\u000a V = proplists:get_value(<<\"_id\">>, Doc, null),\u000a Emit(<<K>>, V)\u000aend.\u000a\u000a", | |
| "reduce": "fun(Keys, Values, ReReduce) -> length(Values) end." | |
| }, | |
| } |
This file contains hidden or 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
| % An a simple erlang couchdb view | |
| % | |
| % For the date see: https://gist.github.com/1125467 | |
| % | |
| fun({Doc}) -> | |
| case {proplists:get_value(<<"book">>, Doc)} of | |
| {undefined} -> | |
| ok; | |
| {Name} -> |
This file contains hidden or 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 Node: | |
| """ | |
| >>> Node(1).append( | |
| ... Node(2)).append( | |
| ... Node(3)).append( | |
| ... Node(4)).append( | |
| ... Node(5)).append( | |
| ... Node(6)).append( | |
| ... Node(7)).append( | |
| ... Node(8)).pprint() |
This file contains hidden or 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 discover(root, classes=[]): | |
| """ | |
| Returns a list of all the sublasses and returns them. A nice way of implementing plug-ins. | |
| """ | |
| for cls in root.__subclasses__(): | |
| classes.append(cls) | |
| discover(cls, classes) | |
| return classes |
This file contains hidden or 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
| # to see the SQL used when I'm in the django python shell | |
| import logging | |
| l = logging.getLogger('django.db.backends') | |
| l.setLevel(logging.DEBUG) | |
| l.addHandler(logging.StreamHandler()) |
This file contains hidden or 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 fields(obj): | |
| return self._meta.fields[:] |
This file contains hidden or 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 os, sys | |
| def load_modules(dir): | |
| package = os.path.realpath(dir) | |
| sys.path.append(package) | |
| for module in [os.path.splitext(fn)[0] for fn in os.listdir(package) if fn.endswith('.py')]: | |
| m = __import__(module) |