Skip to content

Instantly share code, notes, and snippets.

View huanglong-zz's full-sized avatar
🎯
Focusing

Scott Dong huanglong-zz

🎯
Focusing
View GitHub Profile
// 1.Take me nearly 1.5 hours to figure it out
function buildTotalPrice(ths, arrs) {
var _arrs = []
var l = ths.length - 1
for (var i = 0; i < l; i++) {
var _arr = 0
for (var n = 0, m = arrs.lenth; n < m; n++) {
# rename file's name:
for f in *.eco;do base=${f/.eco/};mv $f $base;done
# Pretty mongodb output:
db.collection.find().pretty()
# Pretty mongodb output by default:
DBQuery.prototype._prettyShell = true
to $HOME/.mongorc.js
官方 http://registry.npmjs.org/
stdyun http://npm.stdyun.com
清华 http://npm.tuna.tsinghua.edu.cn/registry
1. config 命令:
npm config set registry http://npm.stdyun.com
2. 命令行指定:
npm --registry http://npm.stdyun.com info underscore
var express = require('express') // require is a function realized by nodejs to import and call other function
var routes = require('./routes')
var http = require('http')
var path = require('path')
var fs = require('fs')
var app = express()
app.locals.title = 'Hello World'
app.configure(function(){
<!DOCTYPE html> <!-- HTML5 doctype 不区分大小写 -->
<html lang="zh-cmn-Hans-CN"> <!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa -->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <!-- 优先使用IE最新版本和 Chrome -->
<!-- width=device-width 会导致 iPhone 5 添加到主屏后以 WebAPP 全屏模式打开页面时出现黑边 http://bigc.at/ios-webapp-viewport-meta.orz -->
<meta name ="viewport" content ="initial-scale=1.0, maximum-scale=3, minimum-scale=1, user-scalable=no">
module.exports = function(grunt) {
// Project Configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
less: {
development: {
options: {
paths: ['public/assets/modules'],
compress: true,
yuicompress: true,
# /usr/local/etc/nginx/nginx.conf
user nobody;
#worker_processes 2;
error_log /usr/local/etc/nginx/log/nginx/error.log warn;
#pid /usr/local/etc/nginx/run/nginx.pid;
events {
worker_connections 1024;
require 'mina/git'
require 'mina/scp'
# require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
# require 'mina/rvm' # for rvm support. (http://rvm.io)
set :term_mode, nil
set :domain, 'xx.xx.xx.xx'
set :deploy_to, '/www/xx.com'
set :backup_to, '/home/xx/dbbackup'
set :repository, '[email protected]'
<?php
$oldtime = time();
$newtime = strtotime(date("Y-m-d H",$oldtime).":00:00");
$seconds = 3600 - $oldtime + $newtime;
$hours = date("H");
echo "<script>var eggSecondsLeft = ".$seconds.", eggHourJust = ".$hours.";</script>";
?>