Skip to content

Instantly share code, notes, and snippets.

View zyzsdy's full-sized avatar
Anchor

Ted Zyzsdy zyzsdy

Anchor
View GitHub Profile
function convert(str){
function getUTF8Length(first3){
var code = parseInt(first3.substr(1), 16);
if((code >> 7 & 1) == 0) return 1;
if((code >> 6 & 1) == 0) return 0;
if((code >> 5 & 1) == 0) return 2;
if((code >> 4 & 1) == 0) return 3;
if((code >> 3 & 1) == 0) return 4;
return 0;
}
@zyzsdy
zyzsdy / Gruntfile.js
Created December 7, 2015 13:40
grunt极速教程配套代码。
module.exports = function (grunt){
grunt.initConfig({
uglify: {
options:{
},
app_task:{
files:{
'./anna.min.js': './anna.js'
}
@zyzsdy
zyzsdy / vue_test_1.html
Last active December 6, 2015 11:07
用Vue.js实现的两个根据输入实时显示颜色的Web App。
<!doctype html>
<html>
<head>
<title>Test</title>
<script src="vue.min.js"></script>
<style>
body{
margin: 0;
}
.out{
@zyzsdy
zyzsdy / PDO_Tutorial.php
Created November 25, 2015 16:25
PHP PDO Tutorial example code.
<?php
/*
* PHP PDO Tutorial
* Author: zyzsdy <[email protected]>
* Github: https://github.com/zyzsdy
*/
$DB_INFO = array(
'type' => 'mysql',
'host' => 'localhost',
'port' => '3306',
@zyzsdy
zyzsdy / letv_getUrl.php
Last active April 23, 2018 09:39
PHP用乐视云视频绝对地址获取器
<?php
//生成api所需信息
$times = time();
$uu = "ab417c1571";//B站uu
$vu = "1233a5fc63";//视频vu
$sign_f = "cfflashformatjsonran".$times."uu".$uu."ver2.2vu".$vu."2f9d6924b33a165a6d8b5d3d42f4f987";//合并签名参数
$sign = md5($sign_f);//计算签名
$api = "http://api.letvcloud.com/gpc.php?cf=flash&sign=".$sign."&ver=2.2&format=json&uu=".$uu."&vu=".$vu."&ran=".$times;//计算api地址
//访问api取得详细信息
$res = file_get_contents($api);