Skip to content

Instantly share code, notes, and snippets.

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

= - = mouyong

💭
I may be slow to respond.
View GitHub Profile
@mouyong
mouyong / arr2json.js
Last active June 11, 2017 12:04
javascript || nodejs 将数组转化为 json 格式的对象
// yarn add lodash
// var _ = require('lodash');
var arr2json = function (array) {
var keys = new Array()
, values = new Array();
for (var o in array) {
keys.push(o);
values.push(array[o]);
@mouyong
mouyong / json ksort 排序
Last active June 11, 2017 12:30
json-ksort.js
var ksort = function(obj, numbersort) {
numbersort = numbersort || true;
var keys = Array.from(Object.keys(obj)).sort()
, numarr = []
, json = {};
for (let o of keys) {
if (numbersort && Number.isInteger(parseInt(o))) {
git config --global merge.tool meld
git config --global diff.tool meld
git config --global mergetool.meld.path “D:\Program Files (x86)\Meld\meld.exe”
@mouyong
mouyong / right-click.bat
Created June 7, 2017 12:41
Sublime text 3 add to REGISTRY KEYS
@echo off
SET sublimeTextPath=D:\Sublime Text Build 3126 x64\sublime_text.exe
REM ADD REGISTRY KEYS
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%sublimeTextPath%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%sublimeTextPath% \"%%1\"" /f
pause
@mouyong
mouyong / .editorconfig
Last active June 7, 2017 12:51
定义 ides 之间如何格式化文件
root = true
[*]
tab_width = 4
ident_size = 4
max_line_length = 80
end_of_line = lf
charset = utf-8
ident_style = space
insert_final_newline = true
@echo off
SET sublimeTextPath=D:\Sublime Text Build 3126 x64\subl.exe
REM ADD REGISTRY KEYS
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%sublimeTextPath%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%sublimeTextPath% \"%%1\"" /f
pause
@mouyong
mouyong / dd_helper.php
Last active May 25, 2017 05:53
在其他框架中使用 dd() 函数
<?php
# install symfony/var-dump to your project
# composer require symfony/var-dumper
// use namespace
use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\VarDumper\Dumper\CliDumper;
use Symfony\Component\VarDumper\Dumper\HtmlDumper as SymfonyHtmlDumper;
@mouyong
mouyong / chmod.sh
Created February 23, 2017 10:13
Modify permissions
#!/usr/bin/env bash
#
# 将给定目录中的所有文件的权限恢复为 umask = 0022
#
# author 牟勇 my24251325@gmail.com
function chmodfile () {
if [ -d "$1" ];then
for file in `ls -al $1 | awk '{print $9}'`
do
@mouyong
mouyong / zsh-config
Last active February 23, 2017 03:37
my z-shell config
plugins=(zsh-navigation-tools zsh-autosuggestions sudo git)
alias zshconfig="vim ~/.zshrc"
alias zshcp='cp /home/mouyong/.zshrc /root'
alias des='cd ~/Desktop/'
alias code='cd ~/Code/'
alias gs='git status'
alias gaa='git add .'
alias gp='git push'