V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
pinclub
V2EX  ›  分享创造

在 Nodeclub 基础上仿花瓣的一个小项目, 有兴趣的小伙伴搞起

  •  
  •   pinclub ·
    pinclub · 2017-10-24 18:22:12 +08:00 · 2188 次点击
    这是一个创建于 2346 天前的主题,其中的信息可能已经有所发展或是发生改变。

    功能还在完善中, 不知道有没有感兴趣的小伙伴一起搞搞.

    Pinclub

    node version build status coverage report Code Climate Gitter

    介绍 / Intro

    Pinclub 是基于 Nodeclub 进行的二次开发. 增加了瀑布流展示方式, 主要参考花瓣网的设计风格(感谢花瓣网的设计师和前端工程师的辛勤工作), 加入了 hanming 距离的算法, 当然是在 mongodb 中使用了 function 的形式实现.

    状态 / Status

    Pinclub 目前处于开发阶段,尚未发布 Stable 版本.

    图片相似度算法说明 / About HammingDistance

    在 Topic 模型中加入了 image 的相关属性值, 其中就包括 image_hash, 使用 imghash 模块生成了 16 bits 的二进制字符串.

    在 Mongodb 中创建了一个 function 命名为 hammingDistance, 代码如下:

    function (a, b) {
    if (typeof(a) === "undefined" || typeof(b) === "undefined") return 64;
    var aa = a.split("");
    var bb = b.split("");
    var count = 0;
    for (var i = 0; i < aa.length; i++) if (aa[i] !== bb[i]) count++;
    return count;
    }
    

    通过 mongo 命令行创建 Function

    创建脚本:

    db.system.js.save(
    {
    _id: "hammingDistance",
    value : function (a, b) {
    if (typeof(a) === "undefined" || typeof(b) === "undefined") return 64;
    var aa = a.split("");
    var bb = b.split("");
    var count = 0;
    for (var i = 0; i < aa.length; i++) if (aa[i] !== bb[i]) count++;
    return count;
    }
    }
    )
    

    Chrome 插件获取外部图

    如果目标网站做了引用保护,则无法完成图片的 Get 操作

    插件下载地址 / Download Chrome plugin

    插件应用商店地址 / Download Chrome plugin from web store

    插件项目地址 / Plugin Project

    TODO / How to Contribute

    如果你想贡献一份力量, 请查看 TODO 列表

    安装部署

    不保证 Windows 系统的兼容性

    线上跑的是 Node.js v4.4.0,MongoDB 是 v3.0.5,Redis 是 v3.0.3。

    1. 安装 `Node.js[必须]` `MongoDB[必须]` `Redis[必须]`
    2. 启动 MongoDB 和 Redis
    3. `$ make install` 安装 Nodeclub 的依赖包
    4. `cp config.default.js config.js` 请根据需要修改配置文件
    5. `$ make test` 确保各项服务都正常
    6. `$ node app.js`
    7. visit `http://localhost:3000`
    8. done!
    

    API 接口文档

    使用 npm run apidoc 命令在本地生成文档后, 访问: http://localhost:3000/public/apidoc

    截图

    首页 上传图片 设置 board 图片 box Get 图片 Dashboard 用户列表 板块列表 板块弹出模态框

    关于 Nodeclub

    Nodeclub 是使用 Node.jsMongoDB 开发的社区系统,界面优雅,功能丰富,小巧迅速, 已在 Node.js 中文技术社区 CNode( http://cnodejs.org) 得到应用,但你完全可以用它搭建自己的社区。

    测试(完善中)

    跑测试

    $ make test
    

    跑覆盖率测试

    $ make test-cov
    

    贡献

    Pinclub 可以联系 @hhdem

    Nodeclub 有任何意见或建议都欢迎提 issue,或者直接提给 @alsotang

    License

    Pinclub is released under the MIT License. Have at it.

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4878 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 09:53 · PVG 17:53 · LAX 02:53 · JFK 05:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.