Skip to content

Instantly share code, notes, and snippets.

View LeonDevLifeLog's full-sized avatar
:octocat:
Focusing

Leon LeonDevLifeLog

:octocat:
Focusing
  • nanjing,jiangsu China
View GitHub Profile
@LeonDevLifeLog
LeonDevLifeLog / numberformat.java
Created July 25, 2017 15:23
java 货币格式化
import Java.text.NumberFormat;
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Double myNumber=23323.3323232323;
@LeonDevLifeLog
LeonDevLifeLog / EditText去除边框
Created July 26, 2017 04:02
Android EditText 去除边框(下划线)
将EditText属性设置修改
android:background="@null"
public class RegexUtils {
/**
* 密码是否正确
*/
public static final String PASSWORD_REGEX = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$";
/**
* 匹配全网IP的正则表达式
*/
public static final String IP_REGEX = "^((?:(?:25[0-5]|2[0-4]\\d|((1\\d{2})|([1-9]?\\d)))\\.){3}(?:25[0-5]|2[0-4]\\d|((1\\d{2})|([1-9]?\\d))))$";
@LeonDevLifeLog
LeonDevLifeLog / DataBindingRecyclerViewAdapter.java
Created July 27, 2017 01:43
Android databinding RecyclerView 万能适配器
public class DataBindingRecyclerViewAdapter extends RecyclerView.Adapter<DataBindingRecyclerViewAdapter.DataBindingViewHolder> {
public static final int TYPE_HEADER = 1, TYPE_FOOTER = 2, TYPE_NORMAL = 0;
public OnBindingViewHolderListener onBindingViewHolderListener;
Context mContext;
int mLayoutId;
int mVarId;
boolean haveHeader = false;
boolean haveFooter = false;
View headerView, footerView;
  1. Git commit template
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.***************************.shb"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName '1.0.0'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@LeonDevLifeLog
LeonDevLifeLog / README.md
Created September 16, 2017 15:32 — forked from savely-krasovsky/README.md
Telegram webhooks with nginx reverse proxy

Make config file:

sudo nano /etc/nginx/sites-available/bot.conf

Then copy and paste bot.conf content and edit YOUR.DOMAIN strings. Now install Let's Encrypt on your server. For example in Debian you need to add jessie-backports and easily install it with apt-get:

sudo apt-get install -t jessie-backports letsencrypt

Then get cert for you domain:

<!DOCTYPE html>
<html class="no-js consumer" data-country="cn" lang="zh-CN">
<head>
<script>
var a=location.href.match(/platform=(win8|win|mac|linux|cros|ios)/),b=window.navigator.userAgent;document.documentElement.id=a&&a[1]||(-1<b.indexOf("Windows NT 6.2")?"win8":-1<b.indexOf("iPad")?"ios":-1<b.indexOf("Windows")?"win":-1<b.indexOf("Mac")?"mac":-1<b.indexOf("CrOS")?"cros":"linux");
if(-1<b.indexOf("MSIE")){var c=-1<b.indexOf("MSIE 6")?" lt-ie10 lt-ie9 lt-ie8 lt-ie7 ie6":-1<b.indexOf("MSIE 7")?" lt-ie10 lt-ie9 lt-ie8 ie7":-1<b.indexOf("MSIE 8")?" lt-ie10 lt-ie9 ie8":-1<b.indexOf("MSIE 9")?" lt-ie10 ie9":-1<b.indexOf("MSIE 10")?" ie10":"";""!==c&&(document.documentElement.className+=c)}if(-1<b.indexOf("Windows NT 5.1")||-1<b.indexOf("Windows NT 5.2"))document.documentElement.className+=" winXP";
</script>
<script src="//www.gstatic.com/external_hosted/modernizr/modernizr.js">
@LeonDevLifeLog
LeonDevLifeLog / cwebp.sh
Created September 18, 2017 07:12
转换png到webp
find ./ -name "*.png" -exec cwebp -q 70 {} -o {}.webp \;
docker run -d -v /home/leon/共享:/home/vsftpd \
-p 20:20 -p 21:21 -p 47400-47470:47400-47470 \
-e FTP_USER=user \
-e FTP_PASS=123456 \
-e PASV_ADDRESS=0.0.0.0 \
--name ftp \
--net=host \
--restart=always bogem/ftp