| 😄 | 😆 | 😊 | 😃 |
😩 | 😔 | 😞 | 😖 | 😨 | 😰 | 😣 | 😢 | 😭 | 😂 | 😲 | 😱 |
| 😫 | 😠 | 😡 | 😤 | 😪 | 😋 | 😷
😎 | 😵 | 👿 | 😈 | 😐 | 😶 | 😇 | 👽 | 💛 | 💙 | 💜 | ❤️ | 💚 | 💔 | 💓 | 💗 | 💕 | 💞 | 💘 | ✨
| var unidecode = require('unidecode'); | |
| var safeString = function (string) { | |
| string = string.trim(); | |
| // Remove non ascii characters | |
| string = unidecode(string).trim(); | |
| // Remove URL reserved chars: `:/?#[]@!$&'()*+,;=` as well as `\%<>|^~£"` | |
| string = string.replace(/[:\/\?#\[\]@!$&'()*+,;=\\%<>\|\^~£"]/g, '') | |
| // Replace dots and spaces with a dash |
| // # Date Helper | |
| // Usage: `{{date format="DD MM, YYYY"}}`, `{{date updated_at format="DD MM, YYYY"}}` | |
| // | |
| // Formats a date using moment.js. Formats published_at by default but will also take a date as a parameter | |
| var moment = require('moment'), | |
| date; | |
| date = function (context, options) { | |
| if (!options && context.hasOwnProperty('hash')) { |
| // # Excerpt Helper | |
| // Usage: `{{excerpt}}`, `{{excerpt words="50"}}`, `{{excerpt characters="256"}}` | |
| // | |
| // Attempts to remove all HTML from the string, and then shortens the result according to the provided option. | |
| // | |
| // Defaults to words="50" | |
| var hbs = require('express-hbs'), | |
| _ = require('lodash'), | |
| downsize = require('downsize'), |
| var paginate = require('handlebars-paginate'); | |
| Handlebars.registerHelper('paginate', paginate); | |
| /* ... */ | |
| var html = template({pagination: { | |
| page: 3, | |
| pageCount: 10 | |
| }}); |
| var Promise = require("bluebird"); | |
| return Promise.map(objects, function (object) { | |
| sails.log.info('An object will be created:'); | |
| sails.log.info(object); | |
| return Comment.findOrCreate(object.id , object); | |
| }).then(function (objects) { | |
| sails.log.info('The objects created or found goes here: '); | |
| sails.log.info(objects); | |
| return objects; |
| /** | |
| * 邮箱字符遮罩 | |
| * @param email | |
| * @returns {string} | |
| * @private | |
| */ | |
| function _hideEmail(email) { | |
| var accounts = email.split('@')[0]; | |
| var suffix = email.split('@')[1]; | |
| var hideNums = Math.floor(accounts.length/2); |
| let chance = require('chance')(); | |
| function generatePhone(nums) { | |
| if (!nums){ | |
| nums = 1; | |
| } | |
| return chance.unique(function generatePhone() { | |
| let phone = '1'; | |
| phone+= chance.string({length: 1, pool: '34578'}); | |
| phone+= chance.string({length: 9, pool: '9876543210'}); |
| /** | |
| 电信 | |
| 中国电信手机号码开头数字 | |
| 2G/3G号段(CDMA2000网络)133、153、180、181、189 | |
| 4G号段 177 | |
| 联通 | |
| 中国联通手机号码开头数字 |
| 😄 | 😆 | 😊 | 😃 |
😩 | 😔 | 😞 | 😖 | 😨 | 😰 | 😣 | 😢 | 😭 | 😂 | 😲 | 😱 |
| 😫 | 😠 | 😡 | 😤 | 😪 | 😋 | 😷
😎 | 😵 | 👿 | 😈 | 😐 | 😶 | 😇 | 👽 | 💛 | 💙 | 💜 | ❤️ | 💚 | 💔 | 💓 | 💗 | 💕 | 💞 | 💘 | ✨
| git init # 初始化本地git仓库(创建新仓库) | |
| git config --global user.name "xxx" # 配置用户名 | |
| git config --global user.email "[email protected]" # 配置邮件 | |
| git config --global color.ui true # git status等命令自动着色 | |
| git config --global color.status auto | |
| git config --global color.diff auto | |
| git config --global color.branch auto | |
| git config --global color.interactive auto | |
| git config --global --unset http.proxy # remove proxy configuration on git | |
| git clone git+ssh://[email protected]/VT.git # clone远程仓库 |