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 Observable | |
| constructor: () -> | |
| Object.defineProperty @, "_observers", { | |
| configurable: false, | |
| enumerable: false, | |
| readable: true, | |
| writable: false, | |
| value: [] | |
| } |
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 <iostream> | |
| template <typename T> | |
| class TestBase { | |
| public: | |
| void TestIface() { | |
| static_cast<T*>(this)->TestImpl(); | |
| } | |
| }; |
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
| template <typename T> | |
| class BasePlatform {}; | |
| class SDLPlatform : BasePlatform<SDLPlatform> {}; | |
| class Win32Platform : BasePlatform<Win32Platform> {}; | |
| #ifdef USE_WINDERS | |
| typedef Win32Platform Platform; | |
| #else |
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 sys | |
| import pygame | |
| from pygame.locals import * | |
| pygame.init() | |
| FPS_RATE = 30 |
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
| from collections import deque | |
| class Dispatcher(object): | |
| _queue = deque() | |
| @staticmethod | |
| def dispatch(func): | |
| Dispatcher._queue.appendleft(func) |
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
| #!/usr/bin/python | |
| import imp | |
| import os | |
| import os.path | |
| import sys | |
| # get the platform-specific list of possible module suffixes. | |
| MODULE_DESC = imp.get_suffixes() |
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
| module Eventable | |
| def def_event(evt_name) | |
| #puts "creating a new event: #{evt_name}" | |
| class_eval do | |
| attr_reader "#{evt_name}_cb" | |
| eval <<-END_EVAL | |
| def on_#{evt_name}(&blk) | |
| (@#{evt_name}_cb ||= []) << blk | |
| nil | |
| end |