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"); |
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
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
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
// 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
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
public static void viewTable(Connection con) throws SQLException { | |
String query = "select COF_NAME, SUP_ID, PRICE, SALES, TOTAL from COFFEES"; | |
try (Statement stmt = con.createStatement()) { | |
ResultSet rs = stmt.executeQuery(query); | |
while (rs.next()) { | |
String coffeeName = rs.getString("COF_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
//正确 | |
long creditCardNumber = 1234_5678_9012_3456L; | |
long socialSecurityNumber = 999_99_9999L; | |
float pi = 3.14_15F; | |
long hexBytes = 0xFF_EC_DE_5E; | |
long hexWords = 0xCAFE_BABE; | |
long maxLong = 0x7fff_ffff_ffff_ffffL; | |
byte nybbles = 0b0010_0101; | |
long bytes = 0b11010010_01101001_10010100_10010010; |
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
package main | |
import "fmt" | |
func main() { | |
fmt.Println("Hello, 世界") | |
} |
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
#compdef go | |
_arguments "1:commands:((\ | |
build\:'compile packages and dependencies' \ | |
clean\:'remove object files' \ | |
doc\:'run godoc on package sources' \ | |
env\:'print Go environment information' \ | |
fix\:'run go tool fix on packages' \ | |
fmt\:'run gofmt on package sources' \ | |
get\:'download and install packages and dependencies' \ |
OlderNewer