Skip to content

Instantly share code, notes, and snippets.

View CodingPapi's full-sized avatar
🎯
Focusing

CodingPuppy CodingPapi

🎯
Focusing
View GitHub Profile
@CodingPapi
CodingPapi / gist:57f0c2428a181dc35ae74bdbb8641dbc
Created December 16, 2019 06:15
var "global" conflect, type/node and react-native
A solution that works for me is to define the types that my project is using in tsconfig.json leaving out the node typing’s like this:
"types": [
"mathjs",
"react",
"react-native",
"react-native-drawer",
"react-native-orientation",
"react-navigation",
"jest"
How to keep git log and less output on the screen
http://serebrov.github.io/html/2014-01-04-git-log-and-less-keep-output.html
Just for git commands:
git config --global --replace-all core.pager "less -iXFR"
For less globally (including git) - add to .bashrc / .zshrc / etc:
export LESS=-iXFR
The options we set for less are:
@CodingPapi
CodingPapi / 配置阿里云 sts,分配 list object 以及list bucket权限
Created July 28, 2018 13:04
配置阿里云 sts,分配 list object 以及list bucket权限
仅为角色分配bucket的action oss:* 仍然无法list bucket中的objects
参考https://www.alibabacloud.com/help/zh/doc-detail/31867.htm
RAM和STS授权策略(Policy)配置
{
"Version": "1",
"Statement": [
{
"Action": [
"oss:GetBucketAcl",
@CodingPapi
CodingPapi / How to keep git log and less output on the screen
Created July 2, 2018 01:14
How to keep git log and less output on the screen
How to keep git log and less output on the screen
When git uses less as pager the output of commands like git log disappears from the console screen when you exit from less. This is not convenient in many cases so here is how to fix this.
Just for git commands:
git config --global --replace-all core.pager "less -iXFR"
For less globally (including git) - add to .bashrc / .zshrc / etc:
@CodingPapi
CodingPapi / install rime for fedora
Created November 10, 2017 14:26
install rime for fedora
dnf install -y ibus-rime
@CodingPapi
CodingPapi / Node dynamic import modules(es6)
Created July 8, 2017 07:12
Node dynamic import modules
ES6 specification doesn't seem to support the dynamic loading of modules:
function renderView(viewName) {
const view = require(path.join('./views', viewName));
...
}
@kruncher dynamic module loads go through System
function renderView (viewName) {
@CodingPapi
CodingPapi / absolute center in ie9
Created April 20, 2017 14:34
absolute center in ie9, only requires a declared height
.Absolute-Center {
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
}
@CodingPapi
CodingPapi / gist:877252d336fea3bb7a257d76e12071b3
Created March 19, 2017 17:18
Count code line number in one command
find . -name "*.java"|xargs cat|grep -v ^$|wc -l
!function test() {
// 捕获异常,递归次数过多调试工具会抛出异常。
try{
!function cir(i)
{
// 当打开调试工具后,抛出异常,setTimeout执行test无参数,此时i == NaN,("" + i / i).length == 3
// debugger设置断点
( 1 !== ( "" + i / i).length || 0===a ) && function(){}.constructor("debugger")(),cir(++i);
} (0)
} catch(e) {