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! Strcmp(...) | |
let a1 = a:1 | |
let a2 = a:2 | |
if a1 =~ '^\d\+$' | |
let a1 = 0 + a1 | |
endif | |
if a2 =~ '^\d\+$' | |
let a2 = 0 + a2 | |
endif |
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
var extend = function(a, b) { | |
for (var i in b) | |
a[i] = b[i]; | |
return a; | |
}; | |
var fluent = function(f) { | |
return function() { | |
var clone = extend(Object.create(null), this); | |
f.apply(clone, arguments); |
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
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url]; | |
[req setHTTPMethod:@"POST"]; // POST 请求 | |
[req setValue: [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundry] forHTTPHeaderField:@"Content-Type"]; //boundry = 0xKhTmLbOuNdArY;可参考 HTTP 协议 | |
[req setValue: @"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36" forHTTPHeaderField: @"User-Agent"]; | |
NSMutableData *postData = [NSMutableData dataWithCapacity:[data length] + 512]; | |
[postData appendData: [[NSString stringWithFormat:@"--%@\r\n", boundry] dataUsingEncoding:NSUTF8StringEncoding]]; | |
[postData appendData: [[NSString stringWithFormat: @"Content-Disposition: form-data; name=\"%@\"; filename=\"%@\"\r\n\r\n", FORM_FLE_INPUT, filename] dataUsingEncoding:NSUTF8StringEncoding]]; // FORM_FLE_INPUT 类似与 <input type="file" name="xxx"> 中的 name 属性值,用来在服务端获取上传的文件,比如 $_FILES['xxx'] |
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
- (void)drawRect:(CGRect) rect { | |
// If you plan to do more drawing later, it's a good idea | |
// to save the graphics state before clipping. | |
[NSGraphicsContext saveGraphicsState]; | |
long r = random(); | |
long g = random(); | |
long b = random(); | |
NSColor *color = [NSColor colorWithRed: (r * 1.0/(r + g + b)) green: (g * 1.0 / (r + g + b)) blue: (b * 1.0 / (r + g + b)) alpha: 1.0]; |
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
{ | |
"name": "Tiny", | |
"require": { | |
"symfony/http-foundation": "2.7.*", | |
"symfony/http-kernel": "2.7.*", | |
"symfony/routing": "2.7.*" | |
} | |
} |
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
call plug#begin() | |
" Make sure you use single quotes | |
Plug 'junegunn/seoul256.vim' | |
Plug 'junegunn/vim-easy-align' | |
" Group dependencies, vim-snippets depends on ultisnips | |
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' |
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
/** | |
* @author xiangshouding<[email protected]> | |
*/ | |
var fs = require('fs'); | |
var util = require('util'); | |
var assert = require('assert'); | |
var argv = process.argv; |
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
#!/usr/bin/env sh | |
cd `pwd` | |
p=' "PHPUnit_TextUI_Command" => '$(find . -name '*.php' | xargs grep 'class PHPUnit_TextUI_Command' | awk -F: '{print $1}' | sed 's/\.\/vendor/$vendorDir . "/')'",' | |
echo $p | |
fixed=`cat vendor/composer/autoload_classmap.php | grep 'PHPUnit_TextUI_Command'` |