ie6 select 覆盖层问题

介绍:ie6 下 select z-index 有bug,导致层不能覆盖其上
目标:解决 ie6 下层不能覆盖在 select 上
原理:利用元素 iframe 可以覆盖 select 的特性
已知问题:需要多余的标签,还需要使用滤镜、以及指定大小
其他:解决这个问题的基础是要用到 iframe ,也可以用 iframe 去包裹 select,另外,jQuery 上有一个插件 bgiframe 也可以解决这个bug。
备注:顺便提一下,iframe 在ie中存在属性 allowTransparency 通过这个属性可以设置 iframe 为透明的。
参考:使用Iframe解决IE6下Div/UL/Li 挡不住Select box 的3法

代码示例,

Git Problem Sets

Command: git mv
Show: fatal: destination exists
To solve: git mv --force
Describe: 当重命名时,如果只是重命名文件名称的大小写,需要加上 --force 参数

Command: git reset, git clean
Show:
To solve: git reset --hard && git clean -xdf
Describe: 多余的文件且没被追踪,需要删除

Problem Sets

  • warning: LF will be replaced by CRLF | fatal: CRLF would be replaced by LF

      在Mac上设置 autocrlf = input, 在Windows上设置autocrlf = true(默认值)。
      Windows:(true)
      提交时,将CRLF 转成 LF再提交;
      切出时,自动将LF 转为 CRLF;
    
      MAC/Linux:    (input)
      提交时,   将CRLF 转成 LF再提交;
      切出时,保持LF即可
    
      这样即可保证仓库中永远都是LF. 而且在Windows工作空间都是CRLF, 在Mac/Linux工作空间都是LF.
    

    [git] warning: LF will be replaced by CRLF | fatal: CRLF would be replaced by LF

Git multiple coexist

解决多个 Git 账户共存问题

Git 的管理工具要求每个 Git User 需要生成一对密钥,公钥和私钥。然后把公/私钥放置于:

//私钥
用户/.ssh/id_rsa
//公钥
用户/.ssh/id_rsa.pub

并且将公钥注册于基于 Git 的代码托管库,类似Github。
当用户用 Git 来管理项目的时候,就是通过生成的公钥和私钥来认证用户的合法性

默认情况下,多个 Git 账户无法在一台机器上协调工作。但通过配置也是可以解决共存问题。有以下两种方式:

  • 在 ssh config 文件中定义 Host
  • 使用 ssh-add

在 ssh config 文件中定义 Host

用户/.ssh 创建 config 文件。(如果有就修改,没有则创建)

写入对每个 Git 账户使用独自的 ssh 密钥的配置:

.ssh/config 注释说明

Host 别名
HostName  域名或 ip
User 登陆服务器用的账号
Port 端口号(默认22,可以不填,如果服务器修改了 ssh 登录端口号,此处需要修改)
IdentityFile 密钥文件的位置

配置.ssh/config

# account for the home repo
Host home.github.com
    HostName github.com
    User inadarei
    IdentitiesOnly yes
    IdentityFile ~/.ssh/id_rsa_home

# account for the work repo
Host work.github.com
    HostName github.com
    User inadarei
    IdentitiesOnly yes
    IdentityFile ~/.ssh/id_rsa_work

这样不同的 Git 账户会使用不同的密钥,但前提是这些密钥都已经按照 config 文件中的配置要求正确放置和命名。

配置git仓库

git remote add origin git@work.github.com

需要把 Git 的配置更改过来,其中 github.com 更换为 work.github.com,这样它会找到对应的 key 来登录。

使用 ssh-add

# start the ssh-agent in the background // 在后台启动 ssh-agent
ssh-agent -s // 这个命令好像有问题,启动不了
# Agent pid 59566
ssh-add ~/.ssh/id_rsa // 添加私钥

可能会遇到的问题

以下是使用 Git Bash 执行

$ ssh-keygen -t rsa -C 'yourname@mail.com' -f id_rsa_yourname
// 生成新的 SSH key:id_rsa_yourname

$ ssh -T git@github.com
Warning: Permanently added 'github.com,192.30.252.131' (RSA) to the list of known hosts.
Permission denied (publickey).
// 连接出错,提示没有权限
// 其实是因为 ssh-add 没有添加成功,或者是 config 没有正确配置

$ ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-7DLTiXwwx9cI/agent.13188; export SSH_AUTH_SOCK;
SSH_AGENT_PID=12892; export SSH_AGENT_PID;
echo Agent pid 12892;
// 这里是输出 ssh-agent 的配置环境

$ eval $(ssh-agent)
Agent pid 13284
// windows 下用这个命令去启动 ssh-agent

$ ssh-add ~/.ssh/id_rsa_example_2
Identity added: /d/Users/test/.ssh/id_rsa_example_2 (/d/Users/test/.ssh/id_rsa_example_2)
// 将密钥添加到 ssh-agent

$ ssh-add ~/.ssh/id_rsa_example_2
Could not open a connection to your authentication agent
// 在shell下执行 $ ssh-agent bash --login -i
// 然后执行 $ ssh-add 就好了。

参考

Using Multiple SSH Keys with Github

配置多个git远程仓库的ssh-Key切换

多个平台git共存

搭建通过 ssh 访问的 Git 服务器

git生成ssh key及本地解决多个ssh key的问题

css triangle

介绍:css 画三角形
目标:为兼容主流浏览器和ie系列
原理:利用元素 border 属性
已知问题:ie下以及老旧的浏览器下会存在锯齿、可能还需要 css hack 来解决视觉显示问题

代码示例,

css 3d

透视

激活 3d空间,需要元素有透视效果。可以有两个方式让元素具有透视效果:使用 transform 属性,它拥有 perspective 功能函数。

transform: perspective(600px);

或者使用 perspective 属性。

perspective: 600px

这两种方式都触发一个 3d空间,但是有一个区别。使用 perspective 功能函数可以方便应用 3d 变换一个元素。但是当应用在多个元素,转换后的元素不会按预计的排列。如果你使用相同的变换应用在不同的元素上,每个元素都会有自己的消失点。为了补救这个问题,在父级元素使用 perspective 属性,这样每个子元素都可以共享相同的 3d空间

perspective 的值决定了 3d 效果的强度。把它看作一个对象与观众的距离。值越大,则距离越远,视觉效果也越不强烈。perspective: 2000px 产生一个巨大的 3d效果,像一个小虫观看巨大的物体。

默认情况下,消失点的位置在三维空间定位的中心。你可以通过属性 perspective-origin 改变消失点的位置。

reference:

Intro to CSS 3D transforms