Skip to content

Instantly share code, notes, and snippets.

View hellokaton's full-sized avatar
:octocat:
Focusing on share

katon hellokaton

:octocat:
Focusing on share
View GitHub Profile
@hellokaton
hellokaton / mysql隔离级别及事务传播
Created February 17, 2016 10:35 — forked from JagoWang/mysql隔离级别及事务传播
mysql隔离级别及事务传播
TRANSACTION(事务隔离级别)
1. ISOLATION_DEFAULT:这是一个PlatfromTransactionManager默认的隔离级别,使用数据库默认的事务隔离级别。
每种数据库的默认隔离级别是不同的,例如SQL Server、Oracle默认Read Commited,MySQL默认Repeatable Read。
另外四个与JDBC的隔离级别相对应,不同的隔离级别采用不同的锁类型来实现,在四种隔离级别中,Serializable的
隔离级别最高,Read Uncommited的隔离级别最低。
2. ISOLATION_READ_UNCOMMITTED:读未提交数据,这是事务最低的隔离级别,在并发的事务中,它充许一个事务可以
读到另一个事务未提交的更新数据。(会出现脏读,不可重复读和幻读)
3. ISOLATION_READ_COMMITTED:读已提交数据,保证在并发的事务中,一个事务修改的数据提交后才能被另外一个事
@hellokaton
hellokaton / Emoji.java
Created April 19, 2016 10:15 — forked from Buttonwood/Emoji.java
表情字符判断
/**
* 判断一个字符是否emoji表情字符
*
* @param ch
* 待检测的字符
*/
public static boolean isEmoji(char ch) {
return !((ch == 0x0) || (ch == 0x9) || (ch == 0xA) || (ch == 0xD)
|| ((ch >= 0x20) && (ch <= 0xD7FF))
|| ((ch >= 0xE000) && (ch <= 0xFFFD)) || ((ch >= 0x10000) && (ch <= 0x10FFFF)));
@hellokaton
hellokaton / reddit_hot_sortAlgorithm_analysis.md
Created April 20, 2016 14:40
Reddit 最新热度排名算法分析

#source code

cdef extern from "math.h":
    double log10(double)
    double sqrt(double)

epoch = datetime(1970, 1, 1, tzinfo = g.tz)

cpdef double epoch_seconds(date):
@hellokaton
hellokaton / fix-homebrew-npm.md
Created August 20, 2016 11:28 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.

@hellokaton
hellokaton / donate-buttons.htm
Created September 1, 2016 14:35 — forked from solicomo/donate-buttons.htm
精简过的PayPal捐赠按钮和OKPay捐赠按钮。前者是基于“立即购买”按钮修改的,因为中国的PayPal账户不能接收捐赠。
<center>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="[email protected]">
<input type="hidden" name="item_name" value="Support cbug.org">
<input type="hidden" name="amount" value="">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" style="border:0px;background:none;" name="submit" alt="PayPal - The safer, easier way to pay online">
</form>
</center>
@hellokaton
hellokaton / ASCII.java
Created September 6, 2016 03:18 — forked from shmert/ASCII.java
Convert images to ASCII text
package ascii;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
/*Copyright (c) 2011 Aravind Rao
@hellokaton
hellokaton / Spring Schema扩展.md
Created October 16, 2016 02:55 — forked from dchjmichael/Spring Schema扩展.md
Spring Schema 扩展介绍

介绍

Spring从2.0开始引入了一个新的机制用于扩展xml模式,我们就可以编写自定义的xml bean解析器然后集成到Spring IoC容器中。

xml扩展大概有以下几个步骤:

  • 编写自定义类
  • 编写xml schema来描述自定义元素
  • 编写NamespaceHandler新样式.css的实现类
  • 编写BeanDefinitionParser实现类
  • 把以上组建注册到Spring
@hellokaton
hellokaton / text3d.css
Created February 26, 2017 11:55 — forked from catouse/text3d.css
CSS3文字效果
h1 {
text-shadow: 0 1px 0 #ccc,
0 2px 0 #c9c9c9,
0 3px 0 #bbb,
0 4px 0 #b9b9b9,
0 5px 0 #aaa,
0 6px 1px rgba(0,0,0,.1),
0 0 5px rgba(0,0,0,.1),
0 1px 3px rgba(0,0,0,.3),
0 3px 5px rgba(0,0,0,.2),
@hellokaton
hellokaton / MethodParamNamesScaner.java
Created April 21, 2017 13:38 — forked from wendal/MethodParamNamesScaner.java
获得方法形参名称列表(Java)
package org.nutz.lang.util;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
@hellokaton
hellokaton / RequsetParser.java
Created May 11, 2017 05:37 — forked from wanghongfei/RequsetParser.java
Netty HTTP请求参数解析器, 支持GET和POST
package cn.fh.http.component;
import cn.fh.http.exception.BaseCheckedException;
import cn.fh.http.exception.MethodNotSupportedException;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.HttpMethod;
import io.netty.handler.codec.http.QueryStringDecoder;
import io.netty.handler.codec.http.multipart.Attribute;
import io.netty.handler.codec.http.multipart.HttpPostRequestDecoder;
import io.netty.handler.codec.http.multipart.InterfaceHttpData;