Skip to content

Instantly share code, notes, and snippets.

View cheng470's full-sized avatar
🌴
On vacation

cheng470 cheng470

🌴
On vacation
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello World</title>
</head>
<body>
<p>Hello World</p>
</body>
</html>
console.info("hello world");
@cheng470
cheng470 / html5.html
Created October 2, 2014 10:00
HTML5 Template
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>HTML5 Template</title>
<style>
#mastHead {}
#mainContent {}
#pageFooter {}
</style>
@cheng470
cheng470 / canvas-rectangle.html
Created October 2, 2014 10:38
在Canvas上绘制一个矩形
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Canvas Rectangle</title>
<style>
body {
background-color: #eee;
}
#outer {
@cheng470
cheng470 / node-hello.js
Created October 4, 2014 01:55
利用node搭建一个非常简单的http服务器
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
}).listen(8124);
console.log('Server running at http://127.0.0.1:8124/');
var getObjInfo = function(obj) {
var s = "", so = "", sf = "";
for (var k in obj) {
var t = typeof obj[k];
if (t === "object") {
so += k + ": " + obj[k] + "\n";
} else if (t === "function") {
sf += k + ": " + obj[k] + "\n";
} else {
s += k + ": " + obj[k] + "(" + t + ")\n";
var browser = (function(){
var s = navigator.userAgent.toLowerCase();
var m = /(webkit)[ \/]([\w.]+)/.exec(s) ||
/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(s) ||
/(msie) ([\w.]+)/.exec(s) ||
(!(/compatible/.test(s)) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec(s)) ||
[];
return {
userAgent: navigator.userAgent,
name: m[1] || "",
@cheng470
cheng470 / css-center.html
Last active August 29, 2015 14:07
页面居中
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body {
text-align: center;
}
.wrapper {
@cheng470
cheng470 / css-two-clomns.html
Last active August 29, 2015 14:07
固定宽度的两列布局
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body {
text-align: center;
}
.wrapper {
@cheng470
cheng470 / css-three-clomns.html
Last active August 29, 2015 14:07
固定宽度的三列布局
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body {
text-align: center;
}
.wrapper {