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 / 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 / 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 / hunttingteacher.user.es6
Created December 24, 2019 02:20
Javascript: overload method format of Date
let getPaddedComp = comp => parseInt(comp) < 10 ? '0' + comp : comp,
o = {
"[y|Y]{4}": date => date.getFullYear(), // year
"[y|Y]{2}": date => date.getFullYear().toString().slice(2), // year
"MM": date => getPaddedComp(date.getMonth() + 1), //month
"M": date => date.getMonth() + 1, //month
"[d|D]{2}": date => getPaddedComp(date.getDate()), //day
"[d|D]{1}": date => date.getDate(), //day
"h{2}": date => getPaddedComp(
(date.getHours() > 12) ? date.getHours() % 12 : date.getHours()), //hour
@cnjimbo
cnjimbo / hunttingteacher.user.es6
Created December 24, 2019 02:19
Javascript: overload clean empty item of Array
//删除数组中的空元素
$.extend(Array.prototype, {
clean: function(deleteValue = "") {
for(var i = 0; i < this.length; i++) {
if(this[i] == deleteValue) {
this.splice(i, 1);
i--;
}
}
return this;
@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);
}
});