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
| public String getTypeOfDayWithSwitchStatement(String dayOfWeekArg) { | |
| String typeOfDay; | |
| switch (dayOfWeekArg) { | |
| case "Monday": | |
| typeOfDay = "Start of work week"; | |
| break; | |
| case "Tuesday": | |
| case "Wednesday": | |
| case "Thursday": | |
| typeOfDay = "Midweek"; |
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 8-bit 'byte' value: | |
| byte aByte = (byte)0b00100001; | |
| // A 16-bit 'short' value: | |
| short aShort = (short)0b1010000101000101; | |
| // Some 32-bit 'int' values: | |
| int anInt1 = 0b10100001010001011010000101000101; | |
| int anInt2 = 0b101; | |
| int anInt3 = 0B101; // The B can be upper or lower case. |
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("c1312.Observable"); | |
| test("c1312.Observable 测试", function() { | |
| var subject = new c1312.Observable(); | |
| var observer_count = 0; | |
| var o1 = function(msg) { | |
| observer_count ++; | |
| equals(msg, 'hello', 'notifyObservers操作1'); | |
| } |
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 c1312 = c1312 || {}; | |
| c1312.Observable = function() { | |
| this._observers = []; | |
| } | |
| c1312.Observable.prototype = { | |
| addObserver: function(o) { | |
| this._observers.push(o); | |
| }, |
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 'zlib' | |
| module ConsistentHashr | |
| @circle = {} | |
| @number_of_replicas = 20 | |
| ## | |
| # Computes a key | |
| def self.hash_key(key) | |
| Zlib.crc32("#{key}") |
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
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <title>HTML5 Canvas Sample</title> | |
| <!--[if IE]><script src="excanvas.js"></script><![endif]--> | |
| <script> | |
| //<![CDATA[ | |
| function drawRect() { | |
| var canvas = document.getElementById("canvas"); |
NewerOlder