var throttle = {
switch:false,
timer:100,
process:function(method,context){
var self = this;
if(self.switch){
return;
}
self.switch = true;
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
| // Some versions to test [v1, v2, expected result] | |
| var versions = [ | |
| ['1.2.0', '1.2', 0], | |
| ['1.4', '1.7.2', 1], | |
| ['1.2pre', '1.2', 1], | |
| ['1.7', '1.1.1', -1], | |
| ['1.7.9RC1', '1.7.9RC2', 1], | |
| ['1.7.9RC1', '1.7.9RC', -1], | |
| ['1.7.9RC1', '1.7.9', 1], | |
| ['0.4beta', '0.4', 1], |
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 getVendorPropertyName(prop) { | |
| // Handle unprefixed versions (FF16+, for example) | |
| if (prop in div.style) return prop; | |
| var prefixes = ['Moz', 'Webkit', 'O', 'ms']; | |
| var prop_ = prop.charAt(0).toUpperCase() + prop.substr(1); | |
| for (var i=0; i<prefixes.length; ++i) { | |
| var vendorProp = prefixes[i] + prop_; | |
| if (vendorProp in div.style) { return vendorProp; } |
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
| // UMD dance - https://github.com/umdjs/umd | |
| !function(root, factory) { | |
| if (typeof define === 'function' && define.amd) { | |
| define(['jquery'], factory); | |
| } else { | |
| factory(root.jQuery); | |
| } | |
| }(this, function($) { | |
| 'use strict'; |
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
| <VirtualHost *> | |
| ServerName example.com | |
| WSGIDaemonProcess www user=max group=max threads=5 | |
| WSGIScriptAlias / /home/max/Projekte/flask-upload/flask-upload.wsgi | |
| <Directory /home/max/Projekte/flask-upload> | |
| WSGIProcessGroup www | |
| WSGIApplicationGroup %{GLOBAL} | |
| Order deny,allow |
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 | |
| $fileName = $_FILES['afile']['name']; | |
| $fileType = $_FILES['afile']['type']; | |
| $fileContent = file_get_contents($_FILES['afile']['tmp_name']); | |
| $dataUrl = 'data:' . $fileType . ';base64,' . base64_encode($fileContent); | |
| $json = json_encode(array( | |
| 'name' => $fileName, | |
| 'type' => $fileType, | |
| 'dataUrl' => $dataUrl, |
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
| this.paths.splice(0,this.paths.length) |
- JavaScript是非类型语言,及变量可以存储任何类型的值。
- JavaScript(以前)的程序多是短小的脚本,所以并不需要那么精确,而且我们从简单的语法中也获益匪浅。
- 变量在使用之前必须先声明(可以不赋值)。
- var声明的变量是永久性的,也就是说用delete运算符来删除这些变量会引发错误。
- 隐式声明的变量总是被创建为全局变量,即使是在函数中创建的。
- 隐式创建的变量可以使用delete运算符删除。
- 没有块级作用域
var scope = "global"
function f(){
<script type="text/javascript">
var jsver = 1.0;
</script>
<script language="Javascript1.1">
jsver = 1.1;
</script>
<script language="Javascript1.2">
jsver = 1.2;
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
| /* | |
| jQuery's document.ready/$(function(){}) should | |
| you wish to use a cross-browser DOMReady solution | |
| without opting for a library. | |
| Demo: http://jsfiddle.net/8j85t/ | |
| usage: | |
| $(function(){ | |
| // your code |