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 | |
| import xml.dom.minidom | |
| from optparse import OptionParser | |
| # usage exportsvg whatever.svg --css=abc.css --output=whatever.png | |
| # uses inkscape | |
| if __name__ == '__main__': | |
| parser = OptionParser() | |
| parser.add_option("-c", "--css", dest="css", help="CSS stylesheet to use when exporting") | |
| parser.add_option("-o", "--output", dest="output", help="specify the output file to use") |
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
| require 'set' | |
| # A SanitizationLevel holds information regarding an XML node's start tag. | |
| # Levels are used to incrementally build sanitized HTML while dealing with | |
| # incomplete nodes (ie, nodes that are never closed). | |
| class SanitizationLevel | |
| # Constructor. | |
| def initialize(tag_name, sanitized, start_pos, end_pos, tagsize) | |
| @tag_name = tag_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
| import threading | |
| from gi.repository import GObject | |
| # calls f on another thread | |
| def async_call(f, on_done): | |
| """ | |
| Starts a new thread that calls f and schedules on_done to be run (on the main | |
| thread) when GTK is not busy. | |
| Args: |
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 | |
| from log_exceptions import log_exceptions | |
| def throw_something(a1, a2): | |
| raise Exception('Whoops!') | |
| @log_exceptions(log_if = os.getenv('MYAPP_DEBUG') is not None) | |
| def my_function(arg1, arg2): | |
| throw_something(arg1 + 24, arg2 - 24) |
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
| #include <jni.h> | |
| #include <mapper.h> | |
| /* Maps the following fictitious Java classes. | |
| class MyEntity { | |
| MyEntity(int id, String name); | |
| int getId(); | |
| void setId(int id); |
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 scala.collection.mutable.HashMap | |
| /** Represents a segment in a router's tree of valid paths. Describes exactly what | |
| * path segments are allowed to come after this one. | |
| */ | |
| class RouteTreeNode(pathSegment:String) { | |
| /** The segment this node represents. */ | |
| private val segment = pathSegment |
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 scala.actors.Actor | |
| import scala.actors.Actor._ | |
| import scala.collection.immutable.HashMap | |
| import scala.collection.mutable.{HashMap => MutableHashMap} | |
| /** | |
| * The type passed to RouterActionInvokers. | |
| * | |
| * The 'message' member can be anything. | |
| */ |
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 scala.actors.Actor | |
| import scala.actors.Actor._ | |
| import scala.collection.immutable.HashMap | |
| import scala.collection.mutable.{HashMap => MutableHashMap} | |
| import scala.util.Random | |
| import scala.math.Ordering._ | |
| import scala.util.Sorting | |
| /** | |
| * The type passed to RouterActionInvokers. |
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
| cakejam = require 'cakejam' | |
| # aliases | |
| jslib = cakejam.targets.jslib | |
| aircert = cakejam.targets.aircert | |
| airapp = cakejam.targets.airapp | |
| # a JavaScript library that will hold all the code in one file | |
| lightspeedjs = jslib 'lightspeedjs', __dirname, | |
| sources: ['src/config.coffee', |
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
| thewire = require 'thewire' | |
| Layout = (data, more_data, body) -> | |
| # ... | |
| View1 = (pages) -> | |
| # ... | |
| View2 = (page) -> | |
| # ... |
OlderNewer