Skip to content

Instantly share code, notes, and snippets.

View bykof's full-sized avatar
:electron:
Let's go to java and have a brainfuck

Michael Bykovski bykof

:electron:
Let's go to java and have a brainfuck
View GitHub Profile
@bykof
bykof / copy_or_move_files_recursively_to_one_folder.py
Last active April 21, 2016 09:13
Copy or move all files from a folder and subfolders to one source folder and don't overwrite duplicate files
import os
import shutil
import click
def copy_or_move_files_from_folder_to_folder(from_folder, to_folder, task='copy', recursive=True):
for current_file in os.listdir(from_folder):
path_to_source = os.path.join(from_folder, current_file)
path_to_destination = os.path.join(to_folder, current_file)
if os.path.isfile(path_to_source):
@bykof
bykof / order.go
Last active February 18, 2020 10:51
package entity
type Order struct {
ID string
UserID string
Sum float64
}
package service
import (
"dashboard/order/domain/entity"
)
type IOrderService interface {
GetOrder(id string) (entity.Order, error)
}
package infrastructure
import (
"dashboard/order/domain/entity"
"encoding/json"
"fmt"
"net/http"
)
type OrderService struct{}
package main
import (
"flamingo.me/dingo"
"flamingo.me/flamingo/v3"
"flamingo.me/flamingo/v3/core/requestlogger"
)
func main() {
flamingo.App(
type (
OrderController struct {
responder *web.Responder
orderService service.IOrderService
}
GetOrderResponse struct {
Order entity.Order
}
)
func (orderController *OrderController) Inject(
responder *web.Responder,
orderService service.IOrderService,
) {
orderController.responder = responder
orderController.orderService = orderService
}
func (orderController *OrderController) Get(ctx context.Context, req *web.Request) web.Result {
orderID, err := req.Query1(orderIDKey)
if err != nil {
return orderController.responder.ServerError(err)
}
order, err := orderController.orderService.GetOrder(orderID)
if err != nil {
return orderController.responder.ServerError(err)
}
@bykof
bykof / routes.go
Last active February 18, 2020 13:55
package api
import (
"dashboard/api/interfaces"
"flamingo.me/flamingo/v3/framework/web"
)
type Routes struct {
orderController application.OrderController
}
package api
import (
"dashboard/order/domain/service"
"dashboard/order/infrastructure"
"flamingo.me/dingo"
"flamingo.me/flamingo/v3/framework/web"
"os"
)