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
| using namespace cryo; | |
| // define some entities | |
| struct author | |
| { | |
| autogenerate<int>::type id; | |
| std::string name; | |
| }; | |
| CRYO_DECLARE_ENTITY(author, id, (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
| # load jsquickhtml as a module if on node.js, | |
| # or assume its been loaded if in the browser | |
| if require? | |
| jsq = require 'jsquickhtml' | |
| else | |
| jsq = window.jsq | |
| # define some elements | |
| div = jsq.lazy_element 'div' |
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) -> | |
| # ... |
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
| 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
| 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.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
| #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 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
| 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: |