分类目录归档:Uncategorized

手机移动端富文本编辑器比较

Quill

Quill is a modern WYSIWYG editor built for compatibility and extensibility. https://quilljs.com – API Driven Design – Custom Content and Formatting – Cross Platform – Easy to Use 重要的是linkedin也在用

Eleditor

  • 兼容Android&ios
  • Eleditor的开发是为了解决移动端项目中的富文本编辑问题。具有
  • 轻量,可定制,注重用户体验等特点 -开源基于MIT协议,允许自由使用和修改代码

simditor

An Easy and Fast WYSIWYG Editor

  • 有插件和文档(非移动优先)

vue-html-editor

A Vue.js component implementing the HTML editor with the jQuery summernote plugin.

Squire

the textarea of the future

Angular-trix

A rich wysiwyg text editor directive for angularjs.

textAngular

textAngular is a super cool WYSIWYG Text Editor directive for AngularJS

Draft.js

Rich Text Editor Framework for React

HTML中的全角、半角空格

HTML提供了5种空格实体(space entity),它们拥有不同的宽度,非断行空格( )是常规空格的宽度,可运行于所有主流浏览器。其他几种空格(       ‌‍)在不同浏览器中宽度各异。

 

它叫不换行空格,全称No-Break Space,它是最常见和我们使用最多的空格,大多数的人可能只接触了 ,它是按下space键产生的空格。在HTML中,如果你用空格键产生此空格,空格是不会累加的(只算1个)。要使用html实体表示才可累加, 该空格占据宽度受字体影响明显而强烈。

 

它叫“半角空格”,全称是En Space,en是字体排印学的计量单位,为em宽度的一半。根据定义,它等同于字体度的一半(如16px字体中就是8px)。名义上是小写字母n的宽度。此空格传承空格家族一贯的特性:透明的,此空格有个相当稳健的特性, 就是其占据的宽度正好是1/2个中文宽度,而且基本上不受字体影响。

 

它叫“全角空格”,全称是Em Space,em是字体排印学的计量单位,相当于当前指定的点数。例如,1 em在16px的字体中就是16px。此空格也传承空格家族一贯的特性:透明的,此空格也有个相当稳健的特性, 就是其占据的宽度正好是1个中文宽度,而且基本上不受字体影响。

 

它叫窄空格,全称是Thin Space。我们不妨称之为“瘦弱空格”,就是该空格长得比较瘦弱,身体单薄,占据的宽度比较小。它是em之六分之一宽。

‌

它叫零宽不连字,全称是Zero Width Non Joiner,简称“ZWNJ”,是一个不打印字符,放在电子文本的两个字符之间,抑制本来会发生的连字,而是以这两个字符原本的字形来绘制。Unicode中的零宽不连字字符映射为“”(zero width non-joiner,U+200C),HTML字符值引用为: ‌

‍

它叫零宽连字,全称是Zero Width Joiner,简称“ZWJ”,是一个不打印字符,放在某些需要复杂排版语言(如阿拉伯语、印地语)的两个字符之间,使得这两个本不会发生连字的字符产生了连字效果。零宽连字符的Unicode码位是U+200D (HTML: ‍ ‍)。

此外,浏览器还会把以下字符当作空白进行解析:空格( )、制表位( )、换行( )和回车( )还有( )等等。

golang的包管理工具

dep – Go dependency tool

Dep is a prototype dependency management tool. It requires Go 1.7 or newer to compile.

dep is NOT an official tool. Yet. Check out the Roadmap! Current status

Alpha. Functionality is known to be broken, missing or incomplete. Changes are planned to the CLI commands soon. It would be unwise to write scripts atop dep before then. The repository is open to solicit feedback and contributions from the community. Please see below for feedback and contribution guidelines.

Gopkg.toml and Gopkg.lock have reached a stable structure, and it is safe to commit them in your projects. We plan to add more to these files, but we guarantee these changes will be backwards-compatible.

glide – Package Management for Golang https://glide.sh

Are you used to tools such as Cargo, npm, Composer, Nuget, Pip, Maven, Bundler, or other modern package managers? If so, Glide is the comparable Go tool.

Manage your vendor and vendored packages with ease. Glide is a tool for managing the vendor directory within a Go package. This feature, first introduced in Go 1.5, allows each package to have a vendor directory containing dependent packages for the project. These vendor packages can be installed by a tool (e.g. glide), similar to go get or they can be vendored and distributed with the package.

Golang Dep

An official package manager has been started for the Go community. We view this as a good thing to bring everyone together around one solution. It’s currently pre-alpha so it’s not ready for prime time usage.

If you start to poke it you’ll see it has a similar style to Glide. While commands may have different names there are many of the same features such as semantic versions and ranges.

Our view is that Glide will be around until an official package manager is ready for production use by the masses. We support the common tool and look forward to the day it is capable of replacing Glide.

Features

  • Ease dependency management
  • Support versioning packages including Semantic Versioning 2.0.0 support. Any constraint the github.com/Masterminds/semver package can parse can be used.
  • Support aliasing packages (e.g. for working with github forks)
  • Remove the need for munging import statements
  • Work with all of the go tools
  • Support the VCS tools that Go supports:
    • git
    • bzr
    • hg
    • svn
  • Support custom local and global plugins (see docs/plugins.md)
  • Repository caching and data caching for improved performance.
  • Flatten dependencies resolving version differences and avoiding the inclusion of a package multiple times.
  • Manage and install dependencies on-demand or vendored in your version control system.

使用php转换URL从相对路径到绝对路径

Transfrom relative path into absolute URL using PHP

function rel2abs($rel, $base)
{
    /* return if already absolute URL */
    if (parse_url($rel, PHP_URL_SCHEME) != '')
        return ($rel);

    /* queries and anchors */
    if ($rel[0] == '#' || $rel[0] == '?')
        return ($base . $rel);

    /* parse base URL and convert to local variables: $scheme, $host, $path, $query, $port, $user, $pass */
    extract(parse_url($base));

    /* remove non-directory element from path */
    $path = preg_replace('#/[^/]*$#', '', $path);

    /* destroy path if relative url points to root */
    if ($rel[0] == '/')
        $path = '';

    /* dirty absolute URL */
    $abs = '';

    /* do we have a user in our URL? */
    if (isset($user)) {
        $abs .= $user;

        /* password too? */
        if (isset($pass))
            $abs .= ':' . $pass;

        $abs .= '@';
    }

    $abs .= $host;

    /* did somebody sneak in a port? */
    if (isset($port))
        $abs .= ':' . $port;

    $abs .= $path . '/' . $rel . (isset($query) ? '?' . $query : '');

    /* replace '//' or '/./' or '/foo/../' with '/' */
    $re = ['#(/\.?/)#', '#/(?!\.\.)[^/]+/\.\./#'];
    for ($n = 1; $n > 0; $abs = preg_replace($re, '/', $abs, -1, $n)) {
    }

    /* absolute URL is ready! */

    return ($scheme . '://' . $abs);
}

跨平台解决方案

桌面端

  • electron:代表作在http://electron.atom.io/apps/,包含atom, visual studio code, bearychat,Slack等,不支持XP系统
  • NW:支持xp系统,官方网站https://nwjs.io/,接口上大体与electron相仿(一位中国作者后台主要负责electron)。
  • Hex:代表作有道词典。官方网站http://hex.youdao.com/zh-cn/index.html

手机端

  • PWA: 相关文章https://github.com/sundway/awesome-pwa,代表作有aliexpress等,消息推送等功能有待验证。
  • react native: 原生应用,代表作http://facebook.github.io/react-native/(有百度facebook,百度百科,QQ),以及http://reactnative.cn/cases.html
  • weex:原生应用,代表作天猫,淘宝,钉钉优酷等,支持安卓,IOS,web三个平台
  • cordova: http://cordova.apache.org/
  • 微信小程序:功能受限

总结

  • 开发桌面应用的话,优先考虑electron,除非需要支持xp系统
  • 开发移动应用,学习成本依次为 PWA < cordava < weex < react native。其中PWA无需熟悉原生应用编程技术,cordava需要少量,而weex与react需要较多。从性能和能实现的功能上来说则顺序相反。
  • weex,react与微信小程序的开发模式都是一样的,都是将html,css代码转换为原生应用。PWA和cordava的开发模式和web差不多,差别在于PWA通过谷歌公司实现推送等原生应用功能,而cordava通过插件实现。
  • weex,react,cordava都需要通过应用渠道进行分发,而PWA需要安装谷歌浏览器57以上版本,微信小程序功能受限。