Skip to content

Instantly share code, notes, and snippets.

@aloha1003
aloha1003 / GoConfigPrivateRepository.md
Created September 11, 2020 09:37 — forked from rodkranz/GoConfigPrivateRepository.md
Go Get from private repository

I had a problem with go get using private repository on gitlab from our company. I lost a few minutes trying to find a solution.... and I did find one:

  1. You need to get a private token at:

    https://gitlab.mycompany.com/profile/account

  2. Configure you git to add extra header with your private token:

$ git config --global http.extraheader "PRIVATE-TOKEN: YOUR_PRIVATE_TOKEN"

//宣告搜尋條件
search := map[string]interface{}{
"columnA": 1,
"columnB >": 2,
"columnC <" : 3,
}
//宣告grom物件
model =model.XXX{}
@aloha1003
aloha1003 / golang grom repository
Last active August 3, 2020 07:25
golang grom repository
func (r *RedisDao) DelByPattern(pattern string) error {
keys, err := redis.Strings(r.conn.Do("KEYS", pattern))
if err != nil {
// handle error
}
for _, key := range keys {
_, err = r.conn.Do("DEL", key)
// r.Del(key)
@aloha1003
aloha1003 / 104打卡
Last active April 27, 2020 05:33
104打卡
<?php
//先做时间检查,如果不是8:40~10:00, 18:00~1900,就pass
//設置時區
date_default_timezone_set('Asia/Taipei');
$now = time();
$eightForth = strtotime(date("Y-m-d ")."8:40:00");
$ten = strtotime(date("Y-m-d ")."10:00:00");
$eighteen = strtotime(date("Y-m-d ")."18:00:00");
$nineteen = strtotime(date("Y-m-d ")."19:00:00");
$morningTest = (($now>=$eightForth) && ($now<=$ten));
const vueSelectExtend = {
methods: {
selectedPersonOutput(options, column, val) {
return options.find((option) => option[column] === val)
},
optionChange(val, valColumn, dataTarget, dataColumn) {
if (val === undefined || val === null) {
dataTarget[dataColumn] = ''
return ''
}
@aloha1003
aloha1003 / simple_args_parsing.sh
Created January 4, 2019 03:15 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@aloha1003
aloha1003 / Uniqid
Created November 3, 2018 23:52 — forked from McKay1717/Uniqid
PHP uniqid in JAVA
public class Uniqid {
/***
* Copy of uniqid in php http://php.net/manual/fr/function.uniqid.php
* @param prefix
* @param more_entropy
* @return
*/
public String uniqid(String prefix,boolean more_entropy)
{
function glne () {
local str=`git --no-pager log --name-only $* |percol `
if [[ $str =~ ^[[:space:]]*([a-z0-9A-Z_.\/-]*).*$ ]]; then
sublime $(pwd)/${BASH_REMATCH[1]};
fi
}
var search = location.search.substring(1);
JSON.parse('{"' + decodeURI(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g,'":"') + '"}')
// Code generated by SQLBoiler (https://github.com/volatiletech/sqlboiler). DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package models
import (
"bytes"
"database/sql"
"fmt"
"reflect"