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
import {BehaviorSubject, Observable, Subject} from "rxjs"; | |
import {Injectable} from "@angular/core"; | |
import {filter} from "rxjs/operators"; | |
@Injectable() | |
export class PerformanceTimer { | |
private _currentTime$ = new BehaviorSubject<number>(0) | |
private timer: number | null = null; | |
private timeLimit = 0; | |
private unlimit = false; |
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
const SECOND = 1000; | |
const MINUTE = 60 * SECOND; | |
const HOUR = 60 * MINUTE; | |
export function formatPlayerTime(ms: number, options?: {withHour?: boolean}) { | |
if (ms <= 0) { | |
if (!!options?.withHour) { | |
return '00:00:00'; | |
} |
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
if($_REQUEST['clear_products']){ | |
$backend->db->query('TRUNCATE s_variants'); | |
$backend->db->query('TRUNCATE s_products'); | |
$backend->db->query('TRUNCATE s_images'); | |
$backend->db->query('TRUNCATE s_related_products'); | |
$backend->db->query('TRUNCATE s_products_categories'); | |
$backend->db->query('TRUNCATE s_options'); | |
} |
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
// Register your service as usual. I suggest adding it to [providers] in the module definition | |
// Then... | |
... | |
var user = ...; | |
var info = ...; // Optional | |
var timestamp = Date.now() / 1000 | 0; | |
var token = <Get the token from your ws>; | |
this.centrifugeService.connect({ | |
url: 'http://<centrifugoServer>:8000/connection', |
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
/********************************* | |
Поиск на Яндексе | |
*********************************/ | |
$("#search_ya").autocomplete( { | |
source: function(request, response) { | |
$.ajax( { | |
url: "https://catalogapi.site.yandex.net/v1.0", | |
dataType: "json", | |
data: { |
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
... | |
// В начале метода get_products(), где инициализируются переменные | |
$exclude_id_filter = ''; | |
... | |
// В середине файла, где идут схожие првоерки и наполняются пременные | |
if(!empty($filter['exclude_id'])) { | |
$exclude_id_filter = $this->db->placehold('AND p.id NOT IN (?@)', (array)$filter['exclude_id']); | |
} |
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
################################################################ | |
# MIGRATIONS | |
################################################################ | |
LOCAL_BIN := $(CURDIR)/bin | |
GOOSE_VERSION :=v2.7.0 | |
GOOSE_BIN := $(LOCAL_BIN)/goose | |
# Директория с миграцими |
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
version: "3" | |
services: | |
mongodb: | |
image: mongo:latest | |
environment: | |
MONGO_INITDB_ROOT_USERNAME: root | |
MONGO_INITDB_ROOT_PASSWORD: rootpassword | |
ports: | |
- 27017:27017 | |
volumes: |
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 LoginCreds struct { | |
Password string `json:"password"` | |
Email string `json:"email"` | |
} | |
func (h *Handler) UserLogin(w http.ResponseWriter, req *http.Request) { | |
input := LoginCreds{} | |
dec := json.NewDecoder(req.Body) | |
if err := dec.Decode(&input); err != nil { | |
http.Error(w, "email and password not satisfied", http.StatusBadRequest) |
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
version: "3.5" | |
services: | |
nginx: | |
image: nginx | |
volumes: | |
- ./:/app:ro | |
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro | |
restart: "always" | |
ports: |
NewerOlder