This file contains 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
<?php | |
$host = 'test.kvstore.aliyuncs.com'; | |
$port = 6379; | |
$user = 'username'; | |
$pwd = 'password1234'; | |
$key = 'the_stored_key'; | |
$redis = new Redis(); | |
if ($redis->connect($host, $port) == false) { | |
die($redis->getLastError()); |
This file contains 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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>CSS ellipsis</title> | |
</head> | |
<style> | |
div { | |
margin: 20px auto; | |
border: 1px solid #CCC; |
This file contains 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 parentObj = {a:2}; | |
var sunObj = Object.create( parentObj ); | |
parentObj.a; // 2 | |
sunObj.a; // 2 | |
parentObj.hasOwnProperty( "a" ); // true | |
sunObj.hasOwnProperty( "a" ); // false | |
sunObj.a++; // block mode | |
parentObj.a; // 2 | |
sunObj.a; // 3 | |
sunObj.hasOwnProperty("a"); // true ??? |
This file contains 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
for(var i = 1; i <= 5; i++){ | |
setTimeout(function(){ | |
console.log(i); | |
}, 10); | |
} | |
// 5, 5, 5, 5, 5 | |
for(let i = 1; i <= 5; i++){ | |
setTimeout(function(){ |
This file contains 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 MyModules = (function() { | |
var modules = {}; | |
return { | |
defineModule(name, deps, impl) { | |
for (var i = 0; i < deps.length; i++) { | |
deps[i] = modules[deps[i]]; | |
} | |
modules[name] = impl.apply(impl, deps); | |
}, getModule(name) { | |
return modules[name]; |
This file contains 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 lang="en" ng-app="demoApp"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Rank Star</title> | |
<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"> | |
<style> | |
.glyphicon-star.orange{margin-right:3px;padding:2px;border-radius:3px;text-align:center;font-size:10px;color:#FFF;background-color:#f63;} | |
.glyphicon-star.gray{margin-right:3px;padding:2px;border-radius:3px;text-align:center;font-size:10px;background-color:#CCC;color:#FFF;} | |
.big .glyphicon-star{font-size:18px;margin:-2px 8px 0 0;} |
This file contains 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
(function(){ | |
var iframe = document.createElement("iframe"); | |
document.body.appendChild(iframe); | |
var originWindow=iframe.contentWindow, | |
currentWindow=window | |
var origin =Object.keys(originWindow), | |
current =Object.keys(currentWindow), | |
extendAttr={}; | |
current.forEach((key)=>{ | |
if(originWindow[key]===undefined){ |
This file contains 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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<h1>Test http call (<?php echo mt_rand(10,100)?>)</h1> | |
</head> | |
<body> | |
<h1>Test http call</h1> | |
<ul> | |
<li><a href="call.php">Test</a></li> |
This file contains 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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>CSS margin percentage</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> | |
<style> | |
.container{margin:20px auto;padding:20px;width:600px;height:200px;border:1px solid #CCC;} | |
.inner{height:50%;background-color:#F90;margin-top:10%;padding:10%;margin-left:10%;} | |
</style> |
This file contains 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 utils = window.utils = { | |
random: function (min, max) { | |
min = min || 0; | |
max = max || 10000; | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
}, | |
uuid: function (identifyNumber, options) { | |
var time = new Date().getTime(), |