Skip to content

Instantly share code, notes, and snippets.

View cnjimbo's full-sized avatar
💭
I may be slow to respond.

Jimbo Tang cnjimbo

💭
I may be slow to respond.
View GitHub Profile
@cnjimbo
cnjimbo / deletegithistory.sh
Last active September 5, 2023 07:53
sh gists
#!/bin/bash
# 循环子目录,收缩git目录。清理历史记录,删除未引用提交,
# 并执行git reset --hard
for dir in */; do
cd "$dir"
if [ -d .git ]; then
echo "Resetting $dir"
git reset --hard
git prune
git gc
@cnjimbo
cnjimbo / upgrade Assert to Shouldly.md
Last active February 22, 2022 07:43
Upgrade xunit assert to shouldly

change Equal to ShouldBe

from

Assert.Equal\(([^,]+), ([[]\w\d\(\)\.]+)\);

To

@cnjimbo
cnjimbo / TypeMemberLayout.xaml
Created February 16, 2022 07:21 — forked from sliekens/TypeMemberLayout.xaml
StyleCop Type Member Layout for Resharper 9
<?xml version="1.0" encoding="utf-16"?>
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
<TypePattern DisplayName="COM interfaces" Priority="2000">
<TypePattern.Match>
<And>
<Kind Is="Interface" />
<Or>
<HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" />
<HasAttribute Name="System.Runtime.InteropServices.ComImport" />
</Or>
v1.3
/\*[ \s]Unmerged[^\*]*[\r\n]*\*/h
v1.2
/\*[ \s]Unmerged[ \(\)\.\w'\r\n:;=<,>\[\]\{\}\+\?\|\-\!]*\*/
v1.1
/\*[ \s]Unmerged[ \(\)\.\w'\r\n:;=<,>]*\*/
@cnjimbo
cnjimbo / webpack.config.js
Last active October 26, 2021 06:07
webpack
//Use `node --trace-deprecation webpack
process.traceDeprecation = true;
module.exports = {
// Your config
};
@cnjimbo
cnjimbo / cloudSettings
Last active August 18, 2021 03:23
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-08-18T03:23:34.862Z","extensionVersion":"v3.4.3"}
@cnjimbo
cnjimbo / webpack.config.js
Created April 20, 2021 07:04 — forked from xpepermint/webpack.config.js
Webpack Common Configuration File (ReactJS)
'use strict';
/**
* Webpack Configuration File
*
* This is a configuration file for Webpack module bundler. You should customize
* it to fit your project.
*
* To start the development server run:
*
@cnjimbo
cnjimbo / git中merge和rebase的区别.md
Last active February 24, 2021 07:37
git中merge和rebase的区别

最开始实习的时候是使用svn,之后正式工作就一直在使用git,这样算起来,使用git也有两年的时间了。以前带我的同事,让我在拉代码的时候要我使用git pull --rebase,一直很纳闷为什么要那样做,后来遇到拉代码的时候有许多冲突要解决,然后去查找资料,才了解到其中的一些事情。今天分享一下,顺便自己也梳理一下。

git pull

git pull 是 git fetch + git merge FETCH_HEAD 的缩写。所以,默认情况下,git pull就是先fetch,然后执行merge 操作,如果加–rebase 参数,就是使用git rebase 代替git merge。

merge 和 rebase

merge 是合并的意思,rebase是复位基底的意思。

@cnjimbo
cnjimbo / hunttingteacher.user.es6
Created December 24, 2019 02:17
Javascript overload methods of String
$.extend(String.prototype, {
toFloat: function() {
return parseFloat(this);
},
toInt: function() {
return parseInt(this);
},
startsWith: function(str) {
return this.slice(0, str.length) == str;
},
@cnjimbo
cnjimbo / hunttingteacher.user.es6
Created December 24, 2019 02:18
Javascript: overload Number
$.extend(Number.prototype, {
toString: function(num) {
if(isNaN(num)) num = 2;
return this.toFixed(num);
}
});