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
/** | |
* | |
* @param date need translate | |
* @returns {string} date | |
*/ | |
function calcTime(date) { | |
var d = new Date(date); | |
//Deal with dates in milliseconds for most accuracy | |
var utc = d.getTime() + (d.getTimezoneOffset() * 60000); |
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
Show hidden characters
{ "twise": true, //prohibits the use of bitwise operators such as ^ (XOR), | (OR) and others | |
"camelcase": false, //force all variable names to use either camelCase style or UPPER_CASE with underscores | |
"curly": true, //requires you to always put curly braces around blocks in loops and conditionals | |
"eqeqeq": true, //prohibits the use of == and != in favor of === and !== | |
"es3": false, //tells JSHint that your code needs to adhere to ECMAScript 3 specification | |
"forin": true, //requires all `for in` loops to filter object's items with `hasOwnProperty()` | |
"immed": true, //prohibits the use of immediate function invocations without wrapping them in parentheses | |
"indent": 2, //enforces specific tab width | |
"latedef": true, //prohibits the use of a variable before it was defined | |
"newcap": true, //requires you to capitalize names of constructor functions |
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
/** | |
* Copyright (c) 2014 Meizu bigertech, All rights reserved. | |
* http://www.bigertech.com/ | |
* @author liuxing | |
* @date 14-11-24 | |
* @description | |
* | |
*/ | |
var Waterline = require('waterline'); |
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
var bootstrap = require('../../bootstrap.test.js'); | |
var should = require('should'); | |
describe.only('UsersModel', function() { | |
describe('#find()', function() { | |
it('should check find function', function (done) { | |
sails.models.user.find() | |
.then(function(results) { | |
// some tests |
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
var unidecode = require('unidecode'); | |
var safeString = function (string) { | |
string = string.trim(); | |
// Remove non ascii characters | |
string = unidecode(string); | |
// Remove URL reserved chars: `:/?#[]@!$&'()*+,;=` as well as `\%<>|^~£"` | |
string = string.replace(/[:\/\?#\[\]@!$&'()*+,;=\\%<>\|\^~£"]/g, '') | |
// Replace dots and spaces with a dash |
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
import DS from 'ember-data'; | |
var Article = DS.Model.extend({ | |
title: DS.attr(), | |
body: DS.attr(), | |
comments: DS.hasMany('comment',{async:true}) | |
}); | |
Article.reopenClass({ | |
FIXTURES: [ |
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
#user nobody; | |
worker_processes 1; | |
#error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
#pid logs/nginx.pid; |
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
/** | |
* Copyright (c) 2014 Meizu bigertech, All rights reserved. | |
* http://www.bigertech.com/ | |
* @author liuxing | |
* @date 15/3/19 | |
* @description | |
* | |
*/ | |
var unidecode = require('unidecode'); |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
OlderNewer