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
// register the interceptor as a service | |
$provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) { | |
return { | |
// optional method | |
'request': function(config) { | |
// do something on success | |
return config || $q.when(config); | |
}, | |
// optional method |
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
/** | |
* usage: | |
* <form name="form"> | |
* <input type="file" multiple name="uploads" filelistread limit="8" ng-model="uploads" /> | |
* <label ng-show="form.uploads.$error.limit">上传文件数量限制最多为8个</label> | |
* </form> | |
*/ | |
angular.module('testapp', []).directive("filelistread", function() { | |
return { | |
require: 'ngModel', |
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
/** | |
* multiple files upload | |
* usage: | |
* <form name="form"> | |
* <input type="file" multiple name="uploads" filelistread limit="8" ng-model="uploads" /> | |
* <label ng-show="form.uploads.$error.limit">上传文件数量限制最多为8个</label> | |
* </form> | |
*/ | |
angular.module('testapp', []).directive("filelistread", function() { | |
return { |
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
//闭包执行一个立即定义的匿名函数 | |
!function(factory) { | |
//factory是一个函数,下面的koExports就是他的参数 | |
// Support three module loading scenarios | |
if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') { | |
// [1] CommonJS/Node.js | |
// [1] 支持在module.exports.abc,或者直接exports.abc | |
var target = module['exports'] || exports; // module.exports is for Node.js |
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
/** | |
* 实现一个nodejs的Master-Worker的小程序,要求: | |
* 1. Master维护与cpu核数相同的Worker的数量; | |
* 2. Master接收到Worker的disconnect消息时,重启新的Worker进程; | |
* 3. Worker监听1024端口并输出“Hello World”; | |
* 4. 在Worker遇到uncaughtException时,通知Master进程并等待3s后退出 | |
*/ | |
var os = require('os'), | |
cluster = require('cluster'), |
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
<?php | |
require_once("HTML/QuickForm2.php"); | |
require_once("HTML/QuickForm2/Renderer.php"); | |
$languages = array( | |
"" => "Choose Languages:", | |
"C#" => "C#", | |
"JavaScript" => "JavaScript", | |
"Perl" => "Perl", |
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> | |
<meta charset="UTF-8"> | |
<title>testUpload</title> | |
</head> | |
<body> | |
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" | |
enctype="multipart/form-data"> |
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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>testUpload2</title> | |
</head> | |
<body> | |
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" | |
enctype="multipart/form-data"> |
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> | |
<meta charset="UTF-8"> | |
<title>testHTTPUpload</title> | |
</head> | |
<body> | |
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" | |
enctype="multipart/form-data"> |
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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>testCalcSubnet</title> | |
</head> | |
<body> | |
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> | |
IP Address: | |
<br/><input type="text" name="ip[]" size="3" maxlength="3" /> |
OlderNewer