This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Point struct { | |
Lat float64 | |
Lng float64 | |
} | |
func YandexDirectionMapper(old Point, new Point) (float64, float64) { | |
length := math.Sqrt(math.Pow(new.Lng-old.Lng, 2) + math.Pow(new.Lat-old.Lat, 2)) | |
if length == 0 { | |
return 0, 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:root { | |
--clr-primery-200: some color; | |
--ff-primery: "Roboto", sans-serif; | |
} | |
*, *::before, *::after { | |
box-sizing: border-box; | |
} | |
body, h1, h2, h3, p { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// generate react native splash screen | |
// image must be 2208 2208 and psd format and small logo in center center | |
yo rn-toolbox:assets --splash splashscreen.psd --android |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for repo in $(curl "https://gitlab.com/api/v4/projects?private_token=TOKEN&owned=yes" | jq '.[].ssh_url_to_repo' | tr -d '"'); do git clone $repo; done; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"os" | |
"os/signal" | |
"syscall" | |
) | |
func main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`SELECT | |
* | |
FROM | |
Posts | |
WHERE | |
CreateAt `+direction+` (SELECT CreateAt FROM Posts WHERE Id = :PostId) | |
AND ChannelId = :ChannelId | |
AND DeleteAt = 0 | |
ORDER BY CreateAt `+sort+` | |
LIMIT :Limit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dbHost := viper.GetString(`database.host`) | |
dbPort := viper.GetString(`database.port`) | |
dbUser := viper.GetString(`database.user`) | |
dbPass := viper.GetString(`database.pass`) | |
dbName := viper.GetString(`database.name`) | |
connection := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s", dbUser, dbPass, dbHost, dbPort, dbName) | |
val := url.Values{} | |
val.Add("parseTime", "1") | |
val.Add("loc", "Asia/Jakarta") | |
dsn := fmt.Sprintf("%s?%s", connection, val.Encode()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func init() { | |
viper.SetConfigFile(`config.json`) | |
err := viper.ReadInConfig() | |
if err != nil { | |
panic(err) | |
} | |
if viper.GetBool(`debug`) { | |
fmt.Println("Service RUN on DEBUG mode") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// go run main.go --config ./config/config.yaml | |
// go run main.go --config ./config/config.json | |
// go run main.go --config ./config/config.toml | |
// file name also can be any name : config, app and etc. | |
var configFile = flag.String("config", "./config/config.yaml", "Address of config file") | |
func parseConfig() { | |
dir, file := path.Split(*configFile) | |
ext := path.Ext(file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'VundleVim/Vundle.vim' | |
" Add plugins here | |
Plugin 'ctrlpvim/ctrlp.vim' | |
Plugin 'gkapfham/vim-vitamin-onec' | |
Plugin 'itchyny/lightline.vim' |
NewerOlder