-
下载 Nginx 源码包
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
proxy_cache_path /var/cache/nginx/cache levels=1:2 keys_zone=cache:8m max_size=3000m inactive=600m; | |
proxy_temp_path /var/tmp; | |
# the IP(s) on which your node server is running. I chose port 3000. | |
upstream app_the_scratch { | |
server 127.0.0.1:3000 weight=1 fail_timeout=60s; | |
} | |
# the nginx server instance | |
server { |
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
// socket io | |
var app = require('http').createServer(handler), | |
io = require('socket.io').listen(app), | |
fs = require('fs'); | |
app.listen(3000, function() { | |
console.log('Socket IO Server is listening on port 3000'); | |
}); | |
function handler(req, res) { |
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 | |
class RestServer | |
{ | |
public $serviceClass; | |
public function __construct($serviceClass) | |
{ | |
$this->serviceClass = $serviceClass; | |
} |
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
昨天在做登陆请求的时候,脑子一抽,想试试原生的ajax来请求后台,这时候我就写下了下面的代码, | |
``` | |
var xhr = new XMLHttpRequest(); | |
xhr.onreadystatechange = function () { | |
if (xhr.readyState == 4) { | |
if (xhr.status >= 200 && xhr.status < 300 || xhr.status == 304) { | |
console.log(xhr.responseText) | |
} else { | |
//错误处理 |
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
/** | |
* WHY? - BECAUSE EXCEPTIONS/TRY/CATCH IS A GLOBAL HORRIBLE MESS :-( | |
* Check out error handling in golang: https://blog.golang.org/error-handling-and-go | |
*/ | |
/** | |
* Wrap an "unsafe" promise | |
*/ | |
function safePromise(promise) { | |
return promise |
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
# Reference: | |
https://www.cloudgear.net/blog/2015/5-minutes-kubernetes-setup/ | |
# install homebrew and cask | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
# install virtualbox | |
brew cask install virtualbox | |
# install dockertoolbox |
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
❯ rollup --version | |
rollup version 0.25.3 | |
❯ time rollup -c ./rollup.js | |
rollup -c ./rollup.js 4.65s user 0.22s system 118% cpu 4.131 total | |
❯ time webpack | |
Hash: ebb00bbccd954c114d3c | |
Version: webpack 2.0.7-beta | |
Time: 3623ms |
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
form i.icon.error { | |
color: $assertive; | |
} | |
form input + i.icon.error { | |
display: none; | |
margin-left: 8px; | |
} | |
form.ng-submitted input.ng-invalid + i.icon.error { |
- Download the perforce visual tool suite from here: http://www.perforce.com/perforce/downloads/index.html
- Copy only the p4merge.app file into your /Applications/ directory