Skip to content

Instantly share code, notes, and snippets.

View ghostcode's full-sized avatar
🎯
Focusing

蝎子 ghostcode

🎯
Focusing
  • SH,China
View GitHub Profile
@ghostcode
ghostcode / readonly和disabled区别.md
Created August 7, 2014 10:37
readonly和disabled区别

不同:

  • readonly可以获得焦点,可以在submit时提交值。
  • disabled不可以获得焦点,不可以提交值。

相同:

  • 都是只读,不可更改。
@ghostcode
ghostcode / 查看文件内容.md
Last active August 29, 2015 14:05
查看文件内容
cat:由第一行开始显示文件内容

tac:从最后一行开始显示

nl:显示的时候,输出行号

more:一页一页的显示文件内容

less与more类似,可以向前翻页
@ghostcode
ghostcode / 搜索文件.md
Created August 14, 2014 02:20
搜索文件

which (寻找“执行文件”)####

which [-a] commond

参数:

-a :将所有可找到的命令均列出,而不仅仅列出第一个找到的命令名称
@ghostcode
ghostcode / gist:7f3c36a370a8e42b9805
Created September 25, 2014 09:47
contentloaded.js
/*!
* contentloaded.js
*
* Author: Diego Perini (diego.perini at gmail.com)
* Summary: cross-browser wrapper for DOMContentLoaded
* Updated: 20101020
* License: MIT
* Version: 1.2
*
* URL:
@ghostcode
ghostcode / gist:6f507816906bee762ac5
Created September 25, 2014 09:48
documentReady.js
/*
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
@ghostcode
ghostcode / jsversion.md
Last active August 29, 2015 14:07
检测浏览器当前Javascript版本
<script type="text/javascript">
var jsver = 1.0;
</script>
<script language="Javascript1.1">
jsver = 1.1;
</script>
<script language="Javascript1.2">
jsver = 1.2;
@ghostcode
ghostcode / JavaScript-variable.md
Last active October 18, 2015 08:19
JavaScript变量复习
  1. JavaScript是非类型语言,及变量可以存储任何类型的值。
  2. JavaScript(以前)的程序多是短小的脚本,所以并不需要那么精确,而且我们从简单的语法中也获益匪浅。
  3. 变量在使用之前必须先声明(可以不赋值)。
  4. var声明的变量是永久性的,也就是说用delete运算符来删除这些变量会引发错误。
  5. 隐式声明的变量总是被创建为全局变量,即使是在函数中创建的。
  6. 隐式创建的变量可以使用delete运算符删除。
  7. 没有块级作用域
var scope = "global"
function f(){
@ghostcode
ghostcode / vue.js
Created November 22, 2015 14:02
Vue do not work arr.length = 0
this.paths.splice(0,this.paths.length)
@ghostcode
ghostcode / handle_file_upload.php
Created November 29, 2015 11:19 — forked from ebidel/handle_file_upload.php
Uploading files using xhr.send(FormData) to PHP server
<?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,
@ghostcode
ghostcode / flask-upload
Created December 15, 2015 06:28 — forked from dAnjou/flask-upload
Flask upload example
<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