Skip to content

Instantly share code, notes, and snippets.

View moonrailgun's full-sized avatar

moonrailgun moonrailgun

View GitHub Profile
@moonrailgun
moonrailgun / 📊 Weekly development breakdown
Last active February 3, 2023 00:31
Weekly development
TypeScript 24 hrs 48 mins █████████████████▉░░░ 85.6%
JSON 1 hr 21 mins ▉░░░░░░░░░░░░░░░░░░░░ 4.7%
JavaScript 48 mins ▌░░░░░░░░░░░░░░░░░░░░ 2.8%
YAML 36 mins ▍░░░░░░░░░░░░░░░░░░░░ 2.1%
Docker 31 mins ▍░░░░░░░░░░░░░░░░░░░░ 1.8%
@moonrailgun
moonrailgun / hashtable.js
Created October 25, 2018 08:59
a simple hashtable implement with js.
class HashTable {
constructor (size = 16) {
this.bucket = [];
this.bucketSize = size;
}
getHash(str) {
try {
return str.split('').map(function(c) {
return c.charCodeAt();
@moonrailgun
moonrailgun / KMS.Activation.CMD
Created October 10, 2018 12:47
windows与office激活脚本
@echo off
setlocal EnableDelayedExpansion & cd /d "%~dp0"
title KMS通用激活工具
%1 %2
ver|find "5.">nul&&goto :xptooff
mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :start","","runas",1)(window.close)&goto :eof
:start
cls
echo Windows 和 Office 激活
# unix 系统跑分
wget https://soft.itbulu.com/tools/UnixBench5.1.3.tgz
tar -zxvf UnixBench5.1.3.tgz
cd UnixBench
make
./Run
@moonrailgun
moonrailgun / git.sh
Last active May 21, 2018 03:16
Git Command
git checkout -b master origin/master # 根据远程分支创建新分支
# git log 别名
git config --global alias.lm "log --no-merges --color --date=format:'%Y-%m-%d %H:%M:%S' --author='你的名字!自己修改!' --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Cblue %s %Cgreen(%cd) %C(bold blue)<%an>%Creset' --abbrev-commit"
git config --global alias.lms "log --no-merges --color --stat --date=format:'%Y-%m-%d %H:%M:%S' --author='你的名字!自己修改!' --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Cblue %s %Cgreen(%cd) %C(bold blue)<%an>%Creset' --abbrev-commit"
git config --global alias.ls "log --no-merges --color --graph --date=format:'%Y-%m-%d %H:%M:%S' --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Cblue %s %Cgreen(%cd) %C(bold blue)<%an>%Creset' --abbrev-commit"
git config --global alias.lss "log --no-merges --color --stat --graph --date=format:'%Y-%m-%d %H:%M:%S' --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Cblue %s %Cgreen(%cd) %C(bold blue)<%an>%Creset' --abbrev-commit"
@moonrailgun
moonrailgun / index.js
Last active August 3, 2018 07:47
一些自己发现或自己写的一些简化写法
var a = {b: function() {alert("弹窗")}}
// 当a存在的时候才会调用a的b方法。防止抛出异常。
// 等价于
// if(a) {
// a.b()
// }
// 可用于不使用返回值的情况
!a || a.b()
// 快速返回结果并给出无数据的默认值
@moonrailgun
moonrailgun / style.js
Created August 8, 2017 02:34
react native useful snippet
const style = {
layout: (alignItems = 'flex-start', justifyContent = 'flex-start') => ({
alignItems,
justifyContent,
}),
center: () => ({
alignItems: 'center',
justifyContent: 'center',
}),
size: (width, height) => {
@moonrailgun
moonrailgun / react-navigation
Created August 2, 2017 06:33
react 代码片段
# 组合导航状态
import { StackNav, TabNav } from '../AppNavigator';
const stackAction = StackNav.router.getActionForPathAndParams('Root');
const stackState = StackNav.router.getStateForAction(stackAction);
const tabAction = TabNav.router.getActionForPathAndParams('main');
const initialNavState = TabNav.router.getStateForAction(tabAction, stackState);
@moonrailgun
moonrailgun / Object.js
Created July 20, 2017 06:13
IE兼容性处理
// Object.assign for IE11
if(!Object.assign) {
Object.assign = function(target) {
'use strict';
if(target == null) {
throw new TypeError('Cannot convert undefined or null to object');
}
target = Object(target);
for(var index = 1; index < arguments.length; index++) {
@moonrailgun
moonrailgun / delAction.py
Created February 18, 2017 10:21
delete action
import bpy
obj = bpy.data.actions['Idle.001']
obj.user_clear()
#不关闭文件来删除。
#oxox = bpy.data.actions['动作名']
#bpy.data.actions.remove(oxox)