Skip to content

Instantly share code, notes, and snippets.

@huzhennan
huzhennan / gist:378a7dee33c129bfa832c9a2a021d56c
Created November 23, 2018 07:48
spring打印请求信息
package com.example.demo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.stream.Collectors;
@huzhennan
huzhennan / Apache Tomcat 8 Start stop script init.d script
Created January 26, 2018 07:59 — forked from miglen/Apache Tomcat 8 Start stop script init.d script
Apache Tomcat init script (or startup/controll script). Works fine for version 7/8. Read the comments for release history. Feel free to modify, copy and give suggestions. (c) GNU General Public License
#!/bin/bash
#
# description: Apache Tomcat init script
# processname: tomcat
# chkconfig: 234 20 80
#
#
# Copyright (C) 2014 Miglen Evlogiev
#
# This program is free software: you can redistribute it and/or modify it under
@huzhennan
huzhennan / README.md
Created January 11, 2018 14:34 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet
@huzhennan
huzhennan / gist:b50cd24952a67a6189d95c2a42b0872f
Created September 25, 2017 02:24
bash shell开启/关闭http proxy
function start_proxy() {
export HTTP_PROXY=http://localhost:56789
export HTTPS_PROXY=http://localhost:56789
}
function stop_proxy() {
export HTTP_PROXY=""
export HTTPS_PROXY=""
}
@huzhennan
huzhennan / ItemClickSupport.java
Created May 10, 2017 08:23 — forked from nesquena/ItemClickSupport.java
Click handling for RecyclerView
/*
Source: http://www.littlerobots.nl/blog/Handle-Android-RecyclerView-Clicks/
USAGE:
ItemClickSupport.addTo(mRecyclerView).setOnItemClickListener(new ItemClickSupport.OnItemClickListener() {
@Override
public void onItemClicked(RecyclerView recyclerView, int position, View v) {
// do it
}
});
@huzhennan
huzhennan / Acknowledgement.txt
Created November 2, 2016 13:09 — forked from jpayne/Acknowledgement.txt
Start multiple Resque workers with Upstart
Thanks to Jason Roelofs for his article at http://jasonroelofs.com/2012/03/12/manage-and-monitor-resque-with-upstart-and-monit/ which got me most of the way there.
@huzhennan
huzhennan / history.txt
Created May 22, 2016 01:09 — forked from unak/history.txt
The History of Ruby
* Only the releases of the stable versions are enumerated in principle. The releases of the unstable versions especially considered to be important are indicated as "not stable."
* The branches used as the source of each releases are specified, and the branching timing of them are also shown. BTW, before subversionizing of the repository, the term called "trunk" was not used, but this list uses it in order to avoid confusion.
* In order to show a historical backdrop, big conferences (RubyKaigi, RubyConf and Euruko) are also emurated. About the venues of such conferences, general English notations are adopted, in my hope.
* ruby_1_8_7 branch was recut from v1_8_7 tag after the 1.8.7 release becaouse of an accident.
* 1.2.1 release was canceled once, and the 2nd release called "repack" was performed. Although there were other examples similar to this, since the re-releases were performed during the same day, it does not write clearly in particular.
* Since 1.0 was released with the date in large quantities,
@huzhennan
huzhennan / poodir-notes.md
Created April 6, 2016 06:10 — forked from speric/poodir-notes.md
Notes From "Practical Object-Oriented Design In Ruby" by Sandi Metz

Chapter 1 - Object Oriented Design

The purpose of design is to allow you to do design later, and it's primary goal is to reduce the cost of change.

SOLID Design:

  • Single Responsibility Principle: a class should have only a single responsibility
  • Open-Closed Principle: Software entities should be open for extension, but closed for modification (inherit instead of modifying existing classes).
  • Liskov Substitution: Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
  • Interface Segregation: Many client-specific interfaces are better than one general-purpose interface.
```
// android 用浏览器打开url地址
private void openCloudPage(String url) {
Uri page = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW, page);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
}```