# 前言

想要扩展 hexo 的代码高亮支持,所以写下效果供自己参考

# Java

# 普通 java 类

package com.yyj.day3;
/**
 * Created by Yelog on 27/08/16.
 */
public class Person {
    private String name;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    // 重写 String 方法 by Yelog
    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}

# JSP

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="/include/include.inc.jsp" %>
<html>
<head>
    <title>主页</title>
</head>
<body>
<c:forEach var="i" begin="1" end="5">
    Item <c:out value="${i}"/><br>
</c:forEach>
</body>
<script type="text/javascript" src="jquery.js"></script>
</html>

# FreeMarker

<#include "top.ftl" >
<#assign hrefs={"1":"index.html","2":"about.html","3":"contact.html"}>
<#list hrefs as href>
    <li class="nav-item dropdown mega-fluid">
        <#if href=="1">
        ${href}
        <#else>
        <b>${href}</b>
        </#if>
    </li>
</#list>

# HTML/CSS/JAVASCRIPT

# HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>test</title>
    <style>
        a{
            color: rebeccapurple;
            margin-top: 100px;
        }
    </style>
</head>
<body>
<b>hello</b>
<h1>Word</h1>
<a class="btn" href="javascript:hello();">哈哈</a>
</body>
<script>
    function hello() {
        alert("hello");
    }
</script>
</html>

# CSS

.flat-btn.-gray:before{background-color:#445862;}
.btn.-sm{font-size:14px;padding:7px 20px 6px 20px;}
.btn.-xs{font-size:12px;padding:5px 13px;}
.btn.-lg{font-size:18px;padding:12px 40px;}

# JAVASCRIPT

function hello(){
  alert("hello");
  console.log("hello");
}
function startTime()
{
var today=new Date()
var h=today.getHours()
var m=today.getMinutes()
var s=today.getSeconds()
// add a zero in front of numbers<10
m=checkTime(m)
s=checkTime(s)
document.getElementById('txt').innerHTML=h+":"+m+":"+s
t=setTimeout('startTime()',500)
}
function checkTime(i)
{
if (i<10)
  {i="0" + i}
  return i
}

# PYTHON

from multiprocessing import Process, Lock

def f(lock, n) :
    lock.acquire()
    print("hello world %d" % n)
    lock.release()

if __name__ == "__main__" :
    lock = Lock()
    for num in range(10):
        Process(target=f, args=(lock, num)).start()

# sql

#说明:创建数据库
CREATE DATABASE database-name;
#说明:删除数据库
drop database dbname;
#说明:创建新表
create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..);
#查询
select * from table1 where 范围;
#插入
insert into table1(field1,field2) values(value1,value2);
#删除
delete from table1 where 范围
#更新
update table1 set field1=value1 where 范围