├── examples ├── postfix.md ├── prefix.md ├── layout.md ├── module.md └── abbr.md ├── README-zh.md └── README.md /examples/postfix.md: -------------------------------------------------------------------------------- 1 | ```javascript 2 | var postfix = { 3 | ed: '过去式', 4 | ing: '进行时', 5 | able: '具备某个能力', // deletable 6 | es: '名称复数', 7 | s: '名词复数' 8 | } 9 | ``` -------------------------------------------------------------------------------- /examples/prefix.md: -------------------------------------------------------------------------------- 1 | ```javascript 2 | var prefix = { 3 | re: '再来一次', 4 | pre: '之前', // precompile 5 | post: '之后', // PostCSS 6 | multi: '很多', 7 | ex: '前任', 8 | un: '不', // unobtrusive 9 | per: '每一个' 10 | } 11 | ``` -------------------------------------------------------------------------------- /examples/layout.md: -------------------------------------------------------------------------------- 1 | | 语义 | 命名 | 2 | | :--: | :--: | 3 | |布局|layout| 4 | |主体内容|container| 5 | |头部|header| 6 | |主要部分|main| 7 | |侧边栏|sidebar| 8 | |子容器|sub-| 9 | |包含块|-wrap| 10 | |内部的|-inner| 11 | |外部的|-outer| 12 | |行|row| 13 | |列|column| 14 | |区域|region/area/section| 15 | |底部|footer| 16 | |清除浮动|clearfix| 17 | |项|item| -------------------------------------------------------------------------------- /examples/module.md: -------------------------------------------------------------------------------- 1 | | 语义 | 命名 | 2 | | :--: | :--: | 3 | |导航|nav| 4 | |面包屑|crumb| 5 | |菜单|menu| 6 | |选项卡|tab| 7 | |内容|content| 8 | |列表|list| 9 | |排行|rank| 10 | |商标|logo| 11 | |幻灯片|slide| 12 | |提示|tip/msg/hint| 13 | |注册|register| 14 | |弹出框|dialog/model| 15 | |合作伙伴|partner| 16 | |工具条|toolbar| 17 | |标语|banner| 18 | |版权|copyright| 19 | |评论|comment| 20 | |面板|panel| 21 | |手风琴|accordion| 22 | |加载|loading| 23 | |头像|avatar| 24 | |标签|tag| 25 | |表格|table| 26 | |下拉框|dropdown| 27 | -------------------------------------------------------------------------------- /README-zh.md: -------------------------------------------------------------------------------- 1 | # Awesome Name [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome) 2 | 3 | ### 背景 4 | 5 | 1. 代码命名有时候是很头疼的事情,又要`语义化`又要`简洁`又要`大众化`,说到底是为了代码的`可维护性`,所以想把之前写代码中经常用到的命名记录下来。 6 | 7 | 2. 更多是让命名变得更容易,编写代码效率更快,慢慢地喜欢上自己的代码,因为你的代码能告诉别人另外的一种感觉,耐人寻味,把你的代码变成艺术品。比如: 8 | 9 | * `promise`, 之前不知道javascript异步编程的某个基准为啥叫`promise`, 10 | 仔细琢磨了下,感觉意思很耐人寻味。比如javascript异步请求某个数据,它不知道有没有回应, 11 | promise这个意思就是告诉你我会承诺给你回应的,多么浪漫; 12 | * `jquery` 的 `on` `off`来监听和销毁事件等简单易用也形象; 13 | * `fork` github git linux的fork操作,相当于你用餐叉选中你喜欢吃的食物,然后你要怎么吃随便你 14 | 15 | ### 缩写 16 | 17 | 1. __截头法__:取单词前几个字母 如 min sec tel 18 | 2. __元音剔除法__:只保留辅音字母 如 msg src mgr (辅音字母即是除aeiou之外的字符) 19 | 3. __谐音法__:如 4 2 r 20 | 4. 参考__HTML标签__、__zepto__ __jquery__库、__linux命令__等命名 21 | 5. __其他__: [tj counties](https://github.com/component/countries):很多国家名的缩写 22 | 23 | [缩写相关例子](./examples/abbr.md) 24 | 25 | ### 前缀 26 | 27 | [前缀相关例子](./examples/prefix.md) 28 | 29 | ### 后缀 30 | 31 | [后缀相关例子](./examples/postfix.md) 32 | 33 | ### 布局 34 | 35 | [布局相关例子](./examples/layout.md) 36 | 37 | ### 模块 38 | 39 | [模块相关例子](./examples/module.md) 40 | 41 | ### 欢迎补充 42 | 43 | 毕竟一个人的能力是有限的,希望得到大家的支持,来为代码可维护性做一点努力 44 | 45 | ### 参考资料 46 | [UI组件规范](http://huixisheng.github.io/fed/docs/ui-coding-style.html) 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Awesome Name [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome) 2 | 3 | [中文文档](./README-zh.md) 4 | 5 | ### Why 6 | 7 | 1. How to name the variable is a headache thing, not only the semantic and simple, but also 8 | universal. After all, just for the maintainability. So I want to record the name frequently used. 9 | 10 | 2. More for the easily name and code efficiently. Little by little we can enjoy our code, because your 11 | code can make another sense to others, afford for thought. Such as: 12 | 13 | * __Promise__: I didn't know Why the JavaScript's Asynchronous Programming Standard was called 14 | __Promise__. But when i thought it in deepth, i got it. When we fetch some data from the server, 15 | we didn't kown whether the response or not. What the Promise meaning is you have my word, i will 16 | promise to give your response, whether success or failure. 17 | 18 | * __on__ and __off__ in __JQuery__: simple, easy and visual. 19 | * __fork__: you can use fork to select what your favorite food and eat at your disposal 20 | 21 | 22 | ### Abbreviation 23 | 24 | #### How 25 | 26 | 1. Grab some letters in front of the words: __min__ __sec__ __tel__ 27 | 2. Remove the vowel and keep the consonant: __msg__ __src__ __mgr__ 28 | 3. Use the homophonic letter to replace: __4__ __2__ __r__ 29 | 4. Reference to __HTML tag__、__zepto__ __jquery__ and other library、__linux command__ 30 | 5. __Other__: [tj countries](https://github.com/component/countries) many countries 31 | 32 | #### Examples 33 | 34 | [Examples about abbr](./examples/abbr.md) 35 | 36 | ### Prefix 37 | 38 | [Examples about prefix](./examples/prefix.md) 39 | 40 | ### Postfix 41 | 42 | [Examples about postfix](./examples/postfix.md) 43 | 44 | ### Layout 45 | 46 | [Examples about layout](./examples/layout.md) 47 | 48 | ### Module 49 | 50 | [Examples about module](./examples/module.md) 51 | 52 | ### Contribute 53 | 54 | Enjoy the code 55 | 56 | ### Reference 57 | 58 | [UI组件规范](http://huixisheng.github.io/fed/docs/ui-coding-style.html) 59 | -------------------------------------------------------------------------------- /examples/abbr.md: -------------------------------------------------------------------------------- 1 | ```javascript 2 | { 3 | "abbreviation": "abbr", //HTML tag 4 | "address": "addr", 5 | "administrator": "admin", 6 | "analysis": "anlys", 7 | "application": "app", 8 | "application programming interface": "api", 9 | "are": "r", 10 | "architecture": "arch", 11 | "ascending": "asc", 12 | "attribute": "attr", 13 | "authentication": "auth", 14 | "avenue": "ave", 15 | "background": "bg", 16 | "body": "bd", 17 | "business": "biz", 18 | "button": "btn", 19 | "buffer": "buf", 20 | "calculator": "calc", 21 | "column": "col", 22 | "command": "cmd", 23 | "conference": "conf", 24 | "constant": "const", 25 | "content": "cnt", 26 | "context": "cxt", 27 | "control": "ctrl", 28 | "copy": "cp", 29 | "delete": "del", 30 | "dependency": "dep", 31 | "develop": "dev", 32 | "distribution": "dist", 33 | "division": "div", // HTML tag 34 | "do it yourself": "diy", 35 | "document": "doc", 36 | "down": "dn", 37 | "download": "dl", 38 | "element": "el", 39 | "environment": "env", 40 | "evaluate": "eval", 41 | "escape": "esc", 42 | "execute": "exec", 43 | "footer": "ft", 44 | "for": "4", 45 | "format": "fmt", 46 | "frequently asked questions": "faqs", 47 | "function": "fn", 48 | "header": "hd", 49 | "identity card": "id", 50 | "image": "img", 51 | "information": "info", 52 | "insert": "ins", 53 | "introduction": "intro", 54 | "label": "lbl", 55 | "library": "lib", 56 | "list": "ls", 57 | "lock": "lk", 58 | "manager": "mgr", 59 | "markdown": "md", 60 | "maximum": "max", 61 | "message": "msg", 62 | "millimeter": "ml", 63 | "minimum": "min", 64 | "module": "mod", 65 | "move": "mv", 66 | "multiply": "mul", 67 | "navigation": "nav", 68 | "number": "num", 69 | "option": "opt", 70 | "package": "pkg", 71 | "page": "pg", 72 | "parameter": "param", 73 | "password": "pwd", 74 | "picture": "pic", 75 | "position": "pos", 76 | "property": "prop", 77 | "recommendation": "rec", 78 | "register": "reg", 79 | "remove": "rm", 80 | "repository": "repo", 81 | "request": "req", 82 | "response": "res", 83 | "screen": "scr", 84 | "second": "sec", 85 | "something": "sth", 86 | "source": "src", 87 | "srv": "server", 88 | "system": "sys", 89 | "table": "tbl", 90 | "telephone": "tel", 91 | "temp": "tmp", 92 | "template": "tpl", 93 | "to": "2", 94 | "user": "usr", 95 | "value": "val", 96 | "version": "ver", 97 | "window": "win" 98 | } 99 | ``` 100 | --------------------------------------------------------------------------------