MD5: 59bab8f71f8c096cd3f72cd73851515d
Rename it to: Sublime Text
Make it executable with: chmod u+x Sublime\ Text
echo "Hello World!"; |
db.log.events.ensureIndex( { "createdAt": 1 }, { expireAfterSeconds: 3600 } ) |
<?php | |
// Determine ENV | |
define('APPLICATION_ENV', getenv('APPLICATION_ENV') == 'development' || PHP_SAPI == 'cli' ? 'development' : 'production'); | |
// Load the appropriate config file | |
return | |
APPLICATION_ENV == 'development' ? | |
require __DIR__.'/application.development.config.php' : | |
require __DIR__.'/application.production.config.php' | |
; |
如果出现错误:`sh "-c" "node ./scripts/doctor"` failed with 127 | |
ln -s /usr/bin/nodejs /usb/bin/node | |
npm i -g yeoman |
function encrypt(text,key){ | |
var cipher = crypto.createCipher('aes-256-cbc',key) | |
var crypted = cipher.update(text,'utf8','hex') | |
crypted += cipher.final('hex'); | |
return crypted; | |
} | |
function decrypt(text,key){ | |
var decipher = crypto.createDecipher('aes-256-cbc',key) | |
var dec = decipher.update(text,'hex','utf8') |
var koa = require('koa') | |
, mongoose = require('mongoose') | |
, Blog = require('./models/blog') | |
; | |
//连接数据库 | |
var uris = 'mongodb://192.168.1.2/db,mongodb://192.168.1.3/db'; | |
var options = { | |
db: { native_parser: true }, | |
server: {'auto_reconnect': true,'poolSize': 10}, |
#聊天应用 | |
##入门 | |
In this guide we’ll create a basic chat application. It requires almost no basic prior knowledge of Node.JS or Socket.IO, so it’s ideal for users of all knowledge levels. | |
## 介绍 | |
Writing a chat application with popular web applications stacks like LAMP (PHP) has traditionally been very hard. It involves polling the server for changes, keeping track of timestamps, and it’s a lot slower than it should be. | |
Sockets have traditionally been the solution around which most realtime chat systems are architected, providing a bi-directional communication channel between a client and a server. |
//JS在1.6中为Array新增了几个方法map(),filter(),some(),every(),forEach() | |
//@ref http://www.cnblogs.com/xiao-hong/p/3194027.html | |
map()//:返回一个新的Array,每个元素为调用func的结果 | |
filter()//:返回一个符合func条件的元素数组 | |
some()//:返回一个boolean,判断是否有元素是否符合func条件 | |
every()//:返回一个boolean,判断每个元素是否符合func条件 |
npm config set unsafe-perm true |