###移动技术
根据mobileTech项目整理而成,原文地址。
####webapp实践的总结
#!/usr/bin/env bash | |
# This script is meant to build and compile every protocolbuffer for each | |
# service declared in this repository (as defined by sub-directories). | |
# It compiles using docker containers based on Namely's protoc image | |
# seen here: https://github.com/namely/docker-protoc | |
set -e | |
REPOPATH=${REPOPATH-/opt/protolangs} | |
CURRENT_BRANCH=${CIRCLE_BRANCH-"branch-not-available"} |
/** | |
* 计算字符串所占的内存字节数,默认使用UTF-8的编码方式计算,也可制定为UTF-16 | |
* UTF-8 是一种可变长度的 Unicode 编码格式,使用一至四个字节为每个字符编码 | |
* | |
* 000000 - 00007F(128个代码) 0zzzzzzz(00-7F) 一个字节 | |
* 000080 - 0007FF(1920个代码) 110yyyyy(C0-DF) 10zzzzzz(80-BF) 两个字节 | |
* 000800 - 00D7FF | |
00E000 - 00FFFF(61440个代码) 1110xxxx(E0-EF) 10yyyyyy 10zzzzzz 三个字节 | |
* 010000 - 10FFFF(1048576个代码) 11110www(F0-F7) 10xxxxxx 10yyyyyy 10zzzzzz 四个字节 | |
* |
import ( | |
"io" | |
"sync" | |
) | |
var bufpool *sync.Pool | |
func init() { | |
bufpool = &sync.Pool{} | |
bufpool.New = func() interface{} { |
import ( | |
"io" | |
"sync" | |
) | |
var bufpool *sync.Pool | |
func init() { | |
bufpool = &sync.Pool{} | |
bufpool.New = func() interface{} { |
package main | |
import ( | |
"bytes" | |
"encoding/binary" | |
"flag" | |
"io" | |
"log" | |
"os" | |
"runtime" |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>router</title> | |
</head> | |
<body> | |
<ul> | |
<li><a href="#/">turn white</a></li> | |
<li><a href="#/blue">turn blue</a></li> |
###移动技术
根据mobileTech项目整理而成,原文地址。
####webapp实践的总结
Not all random values are created equal - for security-related code, you need a specific kind of random value.
A summary of this article, if you don't want to read the entire thing:
Math.random()
. There are extremely few cases where Math.random()
is the right answer. Don't use it, unless you've read this entire article, and determined that it's necessary for your case.crypto.getRandomBytes
directly. While it's a CSPRNG, it's easy to bias the result when 'transforming' it, such that the output becomes more predictable.uuid
, specifically the uuid.v4()
method. Avoid node-uuid
- it's not the same package, and doesn't produce reliably secure random values.random-number-csprng
.You should seriously consider reading the entire article, though - it's
window.requestAnimFrame = (function() { | |
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(a) { | |
window.setTimeout(a, 1000 / 60) | |
} | |
})(); | |
window.onload = function() { | |
var m = canvas.getContext("2d"), | |
k, g; | |
canvas.width = k = window.innerWidth * 2.1; | |
canvas.height = g = window.innerHeight * 1.4; |