纯 CSS3 实现鼠标移上链接的卡拉OK字幕效果

2016年8月25日 没有评论

直接上 CSS 代码

a {
    display: inline-block;
    color: #404040;
    text-decoration: none;
    overflow: hidden;
    position: relative;
}

a::before {
	content: attr(data-letters);
	color: #f34540;
	width: 0;
	background: #fff;
	overflow: hidden;
	position: absolute;
	top: 0;
	left: 0;
	z-index: 2;
	white-space: nowrap;
	transition: width .5s;
}

a:hover::before{
	width: 100%;
	transition: width .5s;
}

然后就是 HTML 范例

测试一下文字的渐变特效

分类: Day After Day 标签:

给自己编的一个方便管理本地开发环境的批处理

2016年8月18日 没有评论
@echo off
title 开发环境控制面板

:act_main
cls
echo ----------------------------
echo.
echo 1、启动全部服务
echo 2、停止全部服务
echo.
echo 3、启动单个服务
echo 4、停止单个服务
echo.
echo 按 Q 键退出
echo.
echo ----------------------------
echo.

choice /c:1234q /n /m "请输入命令:"

if %errorlevel% EQU 1 goto start_all
if %errorlevel% EQU 2 goto stop_all
if %errorlevel% EQU 3 goto start_one
if %errorlevel% EQU 4 goto stop_one
if %errorlevel% EQU 5 goto act_exit

:act_exit
exit
goto :eof

:start_one
cls
echo ----------------------------
echo.
echo 1、启动 Nginx
echo 2、启动 PHP
echo 3、启动 Memcache
echo 4、启动 MySQL
echo 5、返回
echo.
echo 按 Q 键退出
echo.
echo ----------------------------

choice /c:12345q /n /m "请输入命令:"

if %errorlevel% EQU 1 goto start_nginx
if %errorlevel% EQU 2 goto start_php
if %errorlevel% EQU 3 goto start_memcached
if %errorlevel% EQU 4 goto start_mysql
if %errorlevel% EQU 5 goto act_main
if %errorlevel% EQU 6 goto act_exit

:stop_one
cls
echo ----------------------------
echo.
echo 1、停止 Nginx
echo 2、停止 PHP
echo 3、停止 Memcached
echo 4、停止 MySQL
echo 5、返回
echo.
echo 按 Q 键退出
echo.
echo ----------------------------

choice /c:12345q /n /m "请输入命令:"

if %errorlevel% EQU 1 goto stop_nginx
if %errorlevel% EQU 2 goto stop_php
if %errorlevel% EQU 3 goto stop_memcached
if %errorlevel% EQU 4 goto stop_mysql
if %errorlevel% EQU 5 goto act_main
if %errorlevel% EQU 6 goto act_exit

:start_all
cls
set "act_type=1"
goto start_nginx

:stop_all
cls
set "act_type=1"
goto stop_nginx

ram ---------- 启动 Nginx -------------

:start_nginx
tasklist | find /i "nginx.exe" > Nul && set "nginx_status=1" || set "nginx_status=0"

if "%nginx_status%" == "1" (
    echo Nginx 服务已启动
) else (
    echo Nginx 服务正在启动 .
    C:\Server\RunHiddenConsole.exe C:\Server\Nginx\nginx.exe -p C:\Server\Nginx
    tasklist | find /i "nginx.exe" > Nul && echo Nginx 服务已经启动成功。 || echo Nginx 服务启动失败。
)

echo.

if "%act_type%" == "1" (
    goto start_php
)

sleep 3
exit
goto :eof

ram ---------- 启动 PHP FastCGI -------------

:start_php
tasklist | find /i "php-cgi.exe" > Nul && set "php_status=1" || set "php_status=0"

if "%php_status%" == "1" (
    echo PHP FastCGI 服务已启动
) else (
    echo PHP FastCGI 服务正在启动 .
    C:\Server\RunHiddenConsole.exe C:\Server\PHP\php-cgi.exe -b 127.0.0.1:9999
    tasklist | find /i "php-cgi.exe" > Nul && echo PHP FastCGI 服务已经启动成功。 || echo PHP FastCGI 服务启动失败。
)

echo.

if "%act_type%" == "1" (
    goto start_memcached
)

sleep 3
exit
goto :eof

ram ---------- 启动 Memcached -------------

:start_memcached
net start | find /i "memcached" > Nul && set "memcached_status=1" || set "memcached_status=0"

if "%memcached_status%" == "1" (
    echo Memcached 服务已启动。
    echo.
) else (
    net start memcached
)

if "%act_type%" == "1" (
    goto start_mysql
)

sleep 3
exit
goto :eof

ram ---------- 启动 MariaDB -------------

:start_mysql
net start | find /i "MariaDB" > Nul && set "mariadb_status=1" || set "mariadb_status=0"

if "%mariadb_status%" == "1" (
    echo MariaDB 服务已启动。
    echo.
) else (
    net start MariaDB
)

sleep 3
exit
goto :eof

ram ---------- 停止 Nginx -------------

:stop_nginx
tasklist | find /i "nginx.exe" > Nul && set "nginx_status=1" || set "nginx_status=0"

if "%nginx_status%" == "1" (
    echo Nginx 服务正在停止 .
    taskkill /F /IM nginx.exe > nul
    tasklist | find /i "nginx.exe" > Nul && echo Nginx 服务停止失败。 || echo Nginx 服务已成功停止。
) else (
    echo 没有启动 Ngnix 服务。
)

echo.

if "%act_type%" == "1" (
    goto stop_php
)

sleep 3
exit
goto :eof

ram ---------- 停止 PHP FastCGI -------------

:stop_php
tasklist | find /i "php-cgi.exe" > Nul && set "php_status=1" || set "php_status=0"
if "%php_status%" == "1" (
    echo PHP FastCGI 服务正在停止 .
    taskkill /F /IM php-cgi.exe > nul
    tasklist | find /i "php-cgi.exe" > Nul && echo PHP FastCGI 服务停止失败。 || echo PHP FastCGI 服务已成功停止。
) else (
    echo 没有启动 PHP FastCGI 服务。
)

echo.

if "%act_type%" == "1" (
    goto stop_memcached
)

sleep 3
exit
goto :eof

ram ---------- 停止 Memcached -------------

:stop_memcached
net start | find /i "memcached" > Nul && set "memcached_status=1" || set "memcached_status=0"

if "%memcached_status%" == "1" (
    net stop memcached
) else (
    echo 没有启动 Memcached 服务。
    echo.
)

if "%act_type%" == "1" (
    goto stop_mysql
)

sleep 3
exit
goto :eof

ram ---------- 停止 MariaDB -------------

:stop_mysql
net start | find /i "MariaDB" > Nul && set "mariadb_status=1" || set "mariadb_status=0"

if "%mariadb_status%" == "1" (
    net stop MariaDB
) else (
    echo 没有启动 MariaDB 服务。
    echo.
)

sleep 3
exit
goto :eof
分类: Day After Day 标签:

OneDrive 与坚果云共用一个同步目录的办法

2014年10月15日 没有评论

因为买了 office 365 以及一直使用 windows 8 的缘故,之前一直在使用微软的 OneDrive。最近出于一些对国外服务商在国内的前景的担忧,以及希望能 windows 下与 linux 下很好的同步,遂选用了坚果云来辅助。

原先微软的 OneDrive 已经在 E 盘下有了同步文件夹,路径即 E:/OneDrive

装了坚果云,发现默认只能使用“我的坚果云”作为主同步文件夹名,无法直接指定 E:/OneDrive 做为坚果云的同步文件夹。如此这样难道以后我一份文件要存两个目录?深感不爽。

经过一番摸索,发现退出坚果云,删除“我的坚果云”目录,再打开坚果云客户端,会提示找不到目录,询问你是否改名或者删除,我选了改名,之后就可以指定一个目录,此时可以指定 E:/OneDrive 作为坚果云的同步文件夹了。完美解决问题。

分类: Day After Day 标签:

PHPStorm 真心好多让人别扭的小问题

2014年8月26日 没有评论

之前一直用 netbeans,很多人推荐 phpstorm 都无视掉,后来被迫要用了,没办法就尝试一下,结果各种难受啊。

1、配色方案有个Bug,Identifier 一项的配色跟别的多个项在普通环境下重叠且优先级高,结果就导致整片的颜色一样。比如给一个 Class 的 Constant 定义好了斜体和蓝色。在 Class 内部是正常的,在其他地方通过 Class::Constant 调用就显示成了 Identifier 的配色方案。包括 Class 的属性等都一样。这让我这个完美主义者极度不爽。

2、极差的样式名提示和补全。比如,在样式里有这么一个 .boxBar dl .title{},在编写 html 的时候,无论如何都提示不了 boxBar,更别说后面的 title,除非写成 .boxBar{} .boxBar .title{}。这样才能顺利提醒 boxBar 和 title。真特么的折磨人。

3、极差的类方法提示以及辅助,比如有个类 A 有个 protected 方法 B,我写了个 a 类继承了 A,结果想在 a 里重写 B 方法,无法自动提示 B 的方法名,甚至 parent::B 都不能提示,我特么的……继承类可以调用父级类的 protected 方法没错吧……

看看人家 netbeans 多好,配色个体非常丰富,而且保持一致。样式可以全部列出来,并智能排出优先级给你选择,更加有常用样式名追加在后面给你参考。类方法提示就更方便了,比如上面第三点,在 netbeans 不光可以正常提示和补全,补全还可以采用继承补全(完成方法书写[包括大括号],并嵌入父级方法调用)和完全重写(只完成方法书写[包括大括号])

分类: PHP 标签: