Skip to content

Instantly share code, notes, and snippets.

View WGrape's full-sized avatar
🖥️
24 hours online

WGrape

🖥️
24 hours online
View GitHub Profile
@WGrape
WGrape / Docker with XDebug.md
Created June 28, 2023 08:21 — forked from megahirt/Docker with XDebug.md
Debugging PHP with XDebug v3 inside Docker using VSCode

Debugging PHP with XDebug v3 inside Docker using VSCode

Assumptions / Prerequisites

  • XDebug v3+ inside Docker (e.g. php:7.3-apache Docker image)
  • Running Docker v20.10+
  • VSCode with PHP Debug Extension (Felix Becker)
  • Using Docker Compose for orchestration

Objective

@WGrape
WGrape / .github-ci.yml
Created January 1, 2023 07:32
Run Docker Compose in Github Action
name: Test
on:
push:
branches:
- main
- features/**
- dependabot/**
pull_request:
branches:
@WGrape
WGrape / utils.go
Created May 11, 2022 06:24
The common utils in golang.
package utils
import "unicode"
// IsDigitString 是否为数字字符串
func IsDigitString(str string) bool {
for _, x := range []rune(str) {
if !unicode.IsDigit(x) {
return false
}
@WGrape
WGrape / md5.go
Last active May 8, 2022 17:23
How to use md5 in golang ?
import (
"crypto/md5"
"encoding/hex"
)
// Md5 encode the str
func Md5(s string) string {
h := md5.New()
n, err := h.Write([]byte(s))
if err != nil || n == 0 {
@WGrape
WGrape / snakeToCamelCase.php
Created February 17, 2022 05:16
下划线转驼峰
<?php
function snakeToCamelCase($string){
$result = '';
$subIndexArr = explode('_', $string);
foreach ($subIndexArr as $index => $temp) {
if ($index === 0) {
$result .= $temp;
} else {
$result .= ucfirst($temp);
@WGrape
WGrape / Docker.md
Last active February 27, 2022 08:48
Docker使用指南
@WGrape
WGrape / combination.go
Last active March 11, 2022 15:49
Go语言实现基于树的组合算法
package abstract
import "fmt"
/**
* 树节点结构
*/
type TreeNode struct {
value string
level int
@WGrape
WGrape / README.md
Last active January 1, 2023 07:33
Gists Introduction
@WGrape
WGrape / curlRequest.php
Created January 22, 2022 14:10
Send a simple http request by curl in PHP.
<?php
function curlRequest($url, $method = "GET", $data = "", $userPassword = "")
{
$httpHeader = array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data)
);
$ch = curl_init();
@WGrape
WGrape / ElasticSearch
Last active October 6, 2022 08:59
The common queries of ElasticSearch
// 删除索引
DELETE /artist_sug_0323
GET index_name/_search
{
"query": {
"query_string": {
"default_field": "search_field",
"query": "*anything*"
}