Skip to content

Instantly share code, notes, and snippets.

View hakur's full-sized avatar
😂

Xing Yu hakur

😂
View GitHub Profile
@hakur
hakur / ParseStructWithEnv.go
Created April 15, 2021 09:59
golang parse environment variable as struct value
// first set a env var like SERVER_PORT=8888
var (
Cfg Config
)
type Config struct {
Server Server
Clinet Clinet
LogLevel string
}
@hakur
hakur / docker-image-url-function.sh
Created April 15, 2021 03:51
一些蚊子腿docker镜像url函数。some docker image url functions
#!/bin/bash
set -e;
# joinBy 将一个数组的内容通过特定字符连接起来
# joinBy join an array element to a string by specific string
# 使用方法 joinBy "/" ${array[@]}
# usage joinBy "/" ${array[@]}
# code from https://stackoverflow.com/questions/1527049/how-can-i-join-elements-of-an-array-in-bash
# 代码出处 https://stackoverflow.com/questions/1527049/how-can-i-join-elements-of-an-array-in-bash
function joinBy() {
@hakur
hakur / pager.js
Created July 16, 2018 03:50
simple javascript jquery paginator
// 分页类 使用的js依赖是jquery1.10(其他版本未测试) css依赖是bootstrap.css v2 v3都可以 浏览器需要支持数组join方法
// css class default is bootstrap.css (v2 v3 tested) , js function join() support is requied
// @author 喻兴 yuxing951@gmail.com
// @date 2015-07-20
// @example $('#page').pager(); or $('#page').pager({current:50,pages:600,link:'http://www.baidu.com?a=b'});
(function($) {
$.fn.pager = function(options) {
var defaults = {
page: 1,