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

2017-10-24 18:22:12 +08:00
 pinclub

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

Pinclub

介绍 / 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

截图

关于 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.

2206 次点击
所在节点    分享创造
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/400333

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX