Skip to content

Instantly share code, notes, and snippets.

View SyllaJay's full-sized avatar

Xinyue SyllaJay

  • ByteDance Ltd.
  • Shenzhen
View GitHub Profile
@SyllaJay
SyllaJay / gist:f52bab41503c03236b4bcc14dc557f6c
Created March 19, 2020 12:15 — forked from pironim/gist:2f578c60afb67f156136
git pre-commit hook to check branch name
#!/bin/bash
#
# Pre-commit hooks
# Check branch name
BRANCH_NAME_LENGTH=`git rev-parse --abbrev-ref HEAD | grep -E '^t[0-9]{2,16}\_.*_[A-Za-z]{2,2}$' | wc -c`
if [ ${BRANCH_NAME_LENGTH} -eq 0 ] ; then
echo -e '\E[37;44m'"\033[1mERROR\033[0m in pre-commit hook: vim /export/web/.git/hooks/pre-commit"
echo "Branch name should be like t00000_blah_blah_CA - brand is two letters"
@SyllaJay
SyllaJay / linkmap.js
Created December 26, 2018 10:00 — forked from bang590/linkmap.js
XCode Linkmap Parser
var readline = require('readline'),
fs = require('fs');
var LinkMap = function(filePath) {
this.files = []
this.filePath = filePath
}
LinkMap.prototype = {
start: function(cb) {
@SyllaJay
SyllaJay / OkHttpStack.java
Created December 19, 2016 11:32 — forked from bryanstern/OkHttpStack.java
An OkHttp backed HttpStack for Volley
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
#!/bin/bash
# for remote in `git branch -r | grep -v /HEAD`; do git checkout --track $remote ; done
# for remote in `git branch -r `; do git branch --track $remote; done
ORIGIN=origin
for remote in `git branch -r | grep -v /HEAD`;do
local=${remote#"${ORIGIN}/"}
echo "git branch --track ${local} ${remote}"
git branch --track ${local} ${remote}
done
#!/bin/bash
for branch in `git branch`; do git checkout $branch ; git pull; done
#!/bin/bash
for merged in `git branch --merged | grep -v master`; do git branch -d $merged; done
#!/bin/bash
# This helps you migrate to new repo from origin
USAGE_INFO="Usage: `basename $0` URL-New-Remote"
USAGE_EXAMPLE="Example: `basename $0` git@github.com:user/repo.git"
# Check in usage
case $# in
0)
echo -e "${USAGE_INFO}"
echo -e "${USAGE_EXAMPLE}"
@SyllaJay
SyllaJay / CountDownTimerPrecise.java
Last active November 12, 2015 08:17
A CountDownTimer! More accurate than android.os.CountDownTimer!
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@SyllaJay
SyllaJay / ClearableEditText
Created July 14, 2015 02:22
Android Clearable EditText
package com.tryear.jandroidlib.widget;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
@SyllaJay
SyllaJay / DisplayUtils.java
Last active August 29, 2015 14:24
A android display utility
/**
* Copyright (C) 2014 Jay.
*
* All Rights Reserved.
*/
package com.tryear.jandroid.lib.util;
import android.app.Activity;
import android.content.Context;