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
| Function.prototype.method = function(name, func) | |
| { | |
| this.prototype[name] = func; | |
| return this; | |
| }; | |
| String.method('deentityify', function() | |
| { | |
| var entity = { | |
| quot: '"', |
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
| var serial_maker = (function () { | |
| var prefix = ' '; | |
| var seq = 0; | |
| return { | |
| set_prefix: function (p) { | |
| prefix = String(p); | |
| }, | |
| set_seq: function (s) { | |
| seq = s; |
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
| var mammal = function (spec) { | |
| var that = {}; | |
| that.get_name = function () { | |
| return spec.name; | |
| }; | |
| that.says = function () { | |
| return spec.saying || ''; | |
| }; | |
| return that; |
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
| var eventualiy = function (that) { | |
| var registry = {}; | |
| that.fire = function (event) { | |
| var array, | |
| func, | |
| handler, | |
| i, | |
| type = typeof event === 'string' ? event : event.type; | |
| if (registry.hasOwnProperty(type)) { |
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
| Function.prototype.method = function (name, func) { | |
| this.prototype[name] = func; | |
| return this; | |
| }; | |
| Array.method('reduce', function(f, value) { | |
| var i; | |
| for (i = 0; i < this.length; i += 1) { | |
| value = f(this[i], 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
| # -*- coding: utf-8 -*- | |
| require 'readline' | |
| require 'gnomecanvas2' | |
| require 'timer' | |
| require 'timerserv' | |
| require 'drb/drb' | |
| class Timer | |
| def initialize | |
| @seconds = 60 * 3 |
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
| document.writeln(""); | |
| document.writeln("Hello tkbjs"); | |
| Function.prototype.method = function(name, method) { | |
| if (!this.prototype[name]) { | |
| this.prototype[name] = method; | |
| return this; | |
| } | |
| } | |
| String.method('entityify', function () { |
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
| document.writeln(""); | |
| document.writeln("Hello tkbjs"); | |
| document.writeln("============"); | |
| var text = 'and in it he says "Any damn fool could'; | |
| var pos = text.search(/["']/); | |
| document.writeln(pos); |
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 MyController < NSWindowController | |
| attr_writer :button, :text | |
| attr_accessor :words | |
| def clicked(sender) | |
| puts "Button clicked!" | |
| @text.StringValue = "hello!" | |
| @words.StringValue = "0" | |
| 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
| # -*- coding: utf-8 -*- | |
| framework "Cocoa" | |
| class AppDelegate | |
| def initialize | |
| # NSTimer の初期化 | |
| @timer = NSTimer.scheduledTimerWithTimeInterval(1.0, | |
| target:self, | |
| selector:"output:", | |
| userInfo:nil, |
OlderNewer