Skip to content

Instantly share code, notes, and snippets.

@iridiumcao
iridiumcao / check_git_branch_exists.sh
Created March 22, 2020 13:57
How to check if a git branch exists in the local/remote repository?
# Local:
# https://stackoverflow.com/questions/21151178/shell-script-to-check-if-specified-git-branch-exists
# test if the branch is in the local repository.
# return 1 if the branch exists in the local, or 0 if not.
function is_in_local() {
local branch=${1}
local existed_in_local=$(git branch --list ${branch})
if [[ -z ${existed_in_local} ]]; then
echo 0
@iridiumcao
iridiumcao / encoding.jsp
Last active July 8, 2019 22:20
page encoding
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
or
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
@iridiumcao
iridiumcao / getNext15MinTime.java
Last active July 8, 2019 22:21
得到未来15分钟后的时间
Calendar cal = Calendar.getInstance();
cal.add(Calendar.MINUTE, 15);
cal.getTime();