This file contains hidden or 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
use serde::{Serialize, Serializer}; | |
#[derive(Clone, Debug, Copy)] | |
pub enum ComparisonOperators { | |
EQ(i64), | |
NEQ(Provider), | |
} | |
#[derive(Serialize, Clone, Debug, Copy)] | |
pub enum Provider { |
This file contains hidden or 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
#![deny(clippy::unwrap_used)] | |
#![deny(clippy::expect_used)] | |
#![deny(clippy::panic)] | |
#![deny(unused_must_use)] |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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") | |
} |
NewerOlder