Skip to content

Instantly share code, notes, and snippets.

View iamgoangle's full-sized avatar
:octocat:
Focusing

Teerapong Singthong iamgoangle

:octocat:
Focusing
View GitHub Profile
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.0
@iamgoangle
iamgoangle / pre-commit-golang
Created September 5, 2022 07:34
pre-commit-golang
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.0
hooks:
- id: go-fmt
- id: go-imports
- id: no-go-testing
- id: golangci-lint
- id: go-unit-tests
@iamgoangle
iamgoangle / .pre-commit-config.yaml
Created September 5, 2022 07:24
.pre-commit-config.yaml
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.0
@iamgoangle
iamgoangle / pre-commit-hooks
Created September 5, 2022 07:16
pre-commit-blog
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
@iamgoangle
iamgoangle / 2sum.txt
Created August 10, 2022 06:00
2-sum-challenges
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return the answer in any order.
Example 1:
Input: nums = [2,7,11,15], target = 9
Output: [0,1]
Explanation: Because nums[0] + nums[1] == 9, we return [0, 1].
@iamgoangle
iamgoangle / find_repeat.md
Created August 1, 2022 04:32
Find repeatable number

Given an array that have duplicated member

[9, 8, 2, 6, 1, 8, 5, 3, 4, 7]

You should find the repeat number and share the output like this.

{ 
  '1': 1,
 '2': 1,
@iamgoangle
iamgoangle / hof.go
Created May 27, 2020 16:11
Golang Higher-Order-Function
package main
import (
"fmt"
)
type opt struct {
name string
}
@iamgoangle
iamgoangle / receiver.go
Created September 28, 2019 14:52
Value receiver vs Pointer receiver
package main
import (
"fmt"
)
type Count struct {
People int
}
package rabbitmq
import (
"log"
"math/rand"
"time"
"github.com/streadway/amqp"
)
// demo aum
package main
import (
"fmt"
"time"
)
func receiveOnly(ch <-chan string) {
// ch <- "test" // it will error (send to receive-only type <-chan string)