Skip to content

Instantly share code, notes, and snippets.

View skyjia's full-sized avatar
🎯
Focusing

Sky JIA skyjia

🎯
Focusing
View GitHub Profile
@skyjia
skyjia / git-overwrite-branch.sh
Created July 21, 2021 08:10 — forked from ummahusla/git-overwrite-branch.sh
Git overwrite branch with another branch
# overwrite master with contents of feature branch (feature > master)
git checkout feature # source name
git merge -s ours master # target name
git checkout master # target name
git merge feature # source name
@skyjia
skyjia / deployment-manual.md
Created July 21, 2021 06:20
部署操作手册示例范本

【闲情偶寄】系统部署操作手册

文档负责人:李渔

最后更新时间:2021年7月1日

目录

package main
import (
"fmt"
"regexp"
)
func main() {
e := `^(?P<length>\d+)(?P<unit>[dmy])$`
r := regexp.MustCompile(e)
@skyjia
skyjia / parse_struct.go
Last active May 25, 2020 13:27
Parse go struct
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
"strings"
)
@skyjia
skyjia / update-version.sh
Created August 31, 2017 03:51 — forked from jellybeansoup/update-version.sh
Script for Incrementing Version Numbers
#!/bin/bash
# Link: <https://gist.github.com/jellybeansoup/db7b24fb4c7ed44030f4>
#
# A command-line script for incrementing build numbers for all known targets in an Xcode project.
#
# This script has two main goals: firstly, to ensure that all the targets in a project have the
# same CFBundleVersion and CFBundleShortVersionString values. This is because mismatched values
# can cause a warning when submitting to the App Store. Secondly, to ensure that the build number
# is incremented appropriately when git has changes.
#
@skyjia
skyjia / comments_style.md
Created July 18, 2017 08:54
代码注释规范

代码注释规范

标点, 拼写和语法

注释的通常写法是包含正确大小写和结尾句号的完整语句. 短一点的注释 (如代码行尾注释) 可以随意点, 依然要注意风格的一致性. 完整的语句可读性更好, 也可以说明该注释是完整的, 而不是一些不成熟的想法.

虽然被别人指出该用分号时却用了逗号多少有些尴尬, 但清晰易读的代码还是很重要的. 正确的标点, 拼写和语法对此会有所帮助.

Tag注释

@skyjia
skyjia / paging_with_key.sql
Last active March 18, 2016 14:52
使用Key进行分页
SET @start_key=1005069;
SET @paging_size = 20;
SELECT * FROM (
SELECT
(@row_num:=@row_num + 1) AS `@row_num`,
(@row_num_in_page:=CASE
WHEN f.id = @start_key THEN 0
WHEN @row_num_in_page>=0 THEN @row_num_in_page+1
ELSE -1
@skyjia
skyjia / boot.js
Last active August 29, 2015 14:06 — forked from jdx/boot.js
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run
@skyjia
skyjia / general_interview_questions
Created September 3, 2014 08:19
General interview questions
- What projects are you working on at home?
- What beta toys are you playing with?
- What source control do you use?
- How do you approach your documentation?
- Which tools do you use for keeping track of requirements?
- Give me an example of a project that completely failed?
- How do you design scalable applications?
- What language to you prefer for writing complex algorithms?
- Which tools are needed for testing the quality of your code?
- How to debug a web application from client, frontend, to backend?
@skyjia
skyjia / hide_desktop_icons.sh
Created August 19, 2014 14:14
Hide/Show OSX Desktop Icons
#!/bin/bash
DIR="$HOME/Desktop"
FILE="$DIR/.hidden_icons"
# hide icons for Windows VM
always_hide() {
chflags hidden $DIR/\$RECYCLE.BIN
chflags hidden $DIR/desktop.ini
}