Month: April 2018

Linux: 命令行访问 Dropbox, 命令行查看或上传文件到 Dropbox, 命令行调用Dropbox V2 API

  项目地址:https://github.com/andreafabrizi/Dropbox-Uploader 特征 Cross platform Support for the official Dropbox API v2 No password required or stored Simple step-by-step configuration wizard Simple and chunked file upload File and recursive directory download File and recursive directory upload Shell wildcard expansion (only for upload) De… Read More

Mysql: UTF8, UTF8mb4 和 UTF-16区别, 数据库编码, 数据库保存Emoji表情

1. MySQL 存储编码:用 UTF-8 还是 UTF-16? MySQL 支持多种存储编码,如果存储中文,可以选用 GB2312、UTF-8 或 UTF-16(UCS2) 作为存储编码。如果还要考虑国际化,那么就只能用 UTF-8 或 UTF-16。 这两者中,究竟使用哪种编码更好呢? UTF-8 使用 1 个字节表示数字和英文字母,使用 2 个或 3 个字节表示一个汉字,而 UTF-16 则固定使用 2 个字节。因此,在中文的比重比较大的情况下,使用 UTF-16 会更节省空间。 但是,如果你的 MySQL 是作为 Web 的后端存储,就不能只考虑存储时的编码了,还需要考虑查询和输出的编码。由于网页中 HTML 标签的代码比重较大,所以在国际化的网站(如 Go… Read More

PHP:最好的PHP CURL 类, PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs

  PHP Curl Class: HTTP requests made easy PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs.   项目地址:https://github.com/php-curl-class/php-curl-class   安装 Installation To install PHP Curl Class, simply: $ composer require php-curl-class/php-curl-class For latest commit version: $ composer require php-… Read More

Javascript: 图表类, Chart.js使用总结, 数据可视化, 画折线图实例, Chart.js 快速入门, Chart.js图表的保存/下载

概述 Chart.js是一个HTML5图表库,使用canvas元素来展示各式各样的客户端图表,支持折线图、柱形图、雷达图、饼图、环形图等。在每种图表中,还包含了大量的自定义选项,包括动画展示形式。 Chart.js比较轻量(gzip版本仅4.5k),且不依赖其他库。 Chart.js官网: http://www.chartjs.org/ 使用步骤 第一步:安装 #npm: npm install chart.js --save #Bower: bower install chart.js --save #CDN: https://cdnjs.com/libraries/Chart.js chart.js源码:https://gi… Read More

Javascript: 实现复制内容到粘贴板, clipboardjs用法, 实现复制内容到剪贴板, How TO – Copy Text to Clipboard

  1. 简单方法 HTML <!-- The text field --> <input type="text" value="Hello World" id="myInput"> <!-- The button used to copy the text --> <button onclick="myFunction()">Copy text</button> JavaScript function myFunction() { /* Get the text field */ var copyText = document.getElementById("myInput"); /* Select th… Read More

Linux: date日期格式及加减运算, shell日期处理, shell时间处理

显示时间是个常用的命令,在写shell脚本中也经常会用到与日期相关文件名或时间显示。无论是linux还是windows下都是date命令。 Linux下date命令用法 date [OPTION]… [+FORMAT] date [-u|–utc|–universal] [MMDDhhmm[[CC]YY][.ss]] date命令参数 -d, –date=STRING  显示STRING指定的时间 -f, –file=DATEFILE  类似–date参数显示DATEFILE文件中的每行时间 -ITIMESPEC, –iso-8601[=TIMESPEC]  以ISO  8601 格式显示日期/时间。T… Read More

PHP: 数组成员批量添加前缀, Adding prefix strings to array values

问题: $myarray = array("test", "test2", "test3"); #转换为 $myarray = array("prefix_test", "prefix_test2", "prefix_test3");   方法一: $myarray = array("test", "test2", "test3"); array_walk($myarray, function(&$value, $key) { $value = 'prefix_'.$value; } ); 方法二: $myarray = array("test", "test2", "test3"); $array = array_map(function($v… Read More

PHP: Memcached安装, Memcache/Memcached的PHP操作手册, Memcached使用, Memcached教程

1. memcache和memcached区别   Memcache是什么? Memcache是一个自由和开放源代码、高性能、分配的内存对象缓存系统。用于加速动态web应用程序,减轻数据库负载。它可以应对任意多个连接,使用非阻塞的网络IO。由于它的工作机制是在内存中开辟一块空间,然后建立一个Hash表,Memcached自管理这些Hash表。 Memcached是简单而强大的。它简单的设计促进迅速部署,易于发展所面临的问题,解决了很多大型数据缓存。它的API可供最流行的语言。 Memcache官方网站:http://memcached.org/ Memcached又是什么? Memcache是该系统… Read More

git: 命令行添加项目到 git 仓库, Adding an existing project to GitHub using the command line, 添加项目到 git 空仓库

建立一个新仓库,为了避免错误,直接创建 .gitignore, README.md等文件。 Create a new repository on GitHub. To avoid errors, do not initialize the new repository with README, license, or gitignore files. You can add these files after your project has been pushed to GitHub. 打开终端。Open Terminal. 转换到想要上传的项目目录。Change the current working directory to your local project. git 初始化。… Read More

PHP: 生成颜色,颜色处理,随机生产颜色,TinyColor,随机色彩,随机色系

项目地址:https://github.com/mistic100/RandomColor.php 下载 JS:randomColor.js 下载 PHP:RandomColor.php   Random Color   Options You can pass an options object to influence the type of color it produces. The options object accepts the following properties: hue – 控制颜色的色调,你可以输入色彩的颜色名称,例如:red, orange, yellow, green, blue, purple, pink 和 mono… Read More

Javascript: 生成颜色,颜色处理,随机生产颜色,TinyColor,随机色彩,随机色系

主页:https://github.com/bgrins/TinyColor 下载 JS :tinycolor.js TinyColor JavaScript color tooling TinyColor is a small, fast library for color manipulation and conversion in JavaScript. It allows many forms of input, while providing color conversions and other color utility functions. It has no dependencies. 用法: <script type='text/javascript… Read More