安固途径

知识来源于感觉和经验

最简单js,表格隔行变色

2016-07-26, 星期二|
前端开发

jQuery实现 有利用到jQuery的伪选择器:odd Selector, :even Selector, 事件hover( handlerIn, handlerOut )

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>11 demo - table odd color</title>

  <style>
    table{
      border-collapse: collapse;
    }
    table, td, th{
      border: 1px solid #ccc;
    }
    th, td{
      padding:8px;
    }
    .silver{
      background-color: green !important;
    }
  </style>
</head>
<body>
  &l
...
阅读全文

最简单动画,js让背景滚动起来

2016-07-23, 星期六|
前端开发

利用setInterval(func, interval)函数可以实现最简单的动画

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>404 页面不存在</title>
    <style>
        .bg{
            background-image: url(//qiniu.imesu.co/img/blog/bg-scroll/maze_bg.png);
        }
    </style>
</head>
<body class="bg">

    <script>
        function bgScroll(){
            var bgX = 0;
            setInterval(function(){
                bgX -= 1;
        
...
阅读全文

缺MySQLdb,Windows中Django连接mysql-server出错的解决办法

2016-07-21, 星期四|
Django

报错:django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

方法一:

> pip install MySQL-python

方法一由于网络和编译环境的原因失败率大,最好选用方法二。

方法二:

下载MySQL-python,到sourceforge.net,点击下载

...
阅读全文

在Django使用handlebars.js模版

2016-06-02, 星期四|
Django

handlebarsjs

Handlebars provides the power necessary to let you build semantic templates effectively with no frustration.

Handlebars templates look like regular HTML, with embedded handlebars expressions.

A handlebars expression is a {{, some contents, followed by a }}

Handlebars.js大概就是供给js渲染的一种模版吧,他是用{{, }}这样的标记,但是会和Django本来的模版标记冲突

verbatim

Stops the template engine from rendering the contents of this block tag.

A common use is to allow a JavaScript template layer that collides with Django’

...
阅读全文

Git 保存用户名和密码

2016-05-29, 星期日|
git软件

Git可以将用户名,密码和仓库链接保存在硬盘中,而不用在每次push的时候都输入密码。

保存密码到硬盘一条命令就可以

$ git config credential.helper store

当git push的时候输入一次用户名和密码就会被记录

参考

$ man git | grep -C 5 password
$ man git-credential-store

这样保存的密码是明文的,保存在用户目录~的.git-credentials文件中

$ file ~/.git-credentials
$ cat ~/.git-credentials

引用

EXAMPLES

The point of this helper is to reduce the number of times you must type your username or password. For example:

       $ git config credential.helper store
       $ git push http://example.com/repo.git
     
...
阅读全文