Skip to content

Instantly share code, notes, and snippets.

View daffoxdev's full-sized avatar

daffoxdev daffoxdev

View GitHub Profile
@lyrixx
lyrixx / index.php
Last active February 19, 2024 06:37
How to call private command method in Symfony ?
#!/usr/bin/env php
<?php
require __DIR__ . '/../../vendor/autoload.php';
use Castor\Console\Command\CompileCommand;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
// We extends the CompileCommand, to be able to remove the constructor, because
@reanim8ed
reanim8ed / sample.md
Created September 21, 2020 20:51
[Converting base64 file and moving to path] #symfony #upload #vichupload
  • composer require vich/uploader-bundle
  • In the config/services.yaml, add this configuration (it's just an example)
	# config/services.yaml
	parameters:
		app.path.images: /uploads/images
  • don't forget to create uploads directory inside public directory and images directory inside uploads directory
  • And you configure the file config/packages/vich_uploader.yaml like
@vudaltsov
vudaltsov / Makefile
Created September 26, 2019 19:29
Makefile for a Symfony project
DOCKER_COMPOSE = docker-compose
EXEC_PHP = $(DOCKER_COMPOSE) exec -T php
SYMFONY = $(EXEC_PHP) bin/console
COMPOSER = $(EXEC_PHP) composer
##
## Проект
## ------
install: start db ## Установить и запустить проект
@linuxkathirvel
linuxkathirvel / print-scr-key-to-flameshot-tool-in-gnome3.md
Last active May 6, 2024 16:50
How to assign PrtScr(Print Screen) key to Flameshot screenshot tool in Gnome 3?

How to assign PrtScr(Print Screen) key to Flameshot screenshot tool in Gnome 3?

  1. Goto Keyboard settings and click 'Save a screenshot to Pictures' under 'Screenshots' section.
  2. Press 'Backspace' key delete 'PrtScr' key shortcut and press 'Set' button
  3. Press '+'(Plust) icon in the 'Custom Shortcuts' in the same window
  4. Enter 'Flameshot' in 'Name' field , 'flameshot gui' in 'Command' field, and click 'Set Shortcut' button and press 'PrtScr' button in the keyboard and close the dialog box 5.That's it. If you press 'PrtScr' key, the Flameshot selection area screen will appear.
@dkarlovi
dkarlovi / Dockerfile
Last active April 6, 2023 08:38
Setting up permissions for a (Symfony) web app on Docker
FROM alpine:3.7
# this is the "app" image, contains PHP-FPM
RUN addgroup -g 82 -S www-data && \
adduser -u 82 -H -D -S -G www-data www-data && \
# etc..
# PHP-FPM is setup to run as "www-data"
WORKDIR /app
@iamstoick
iamstoick / import.md
Created June 14, 2017 05:03
How to import database in MySQL in Docker?

This is a simple way of importing MySQL database in Docker.

  1. In you Dockerfile you must have a shared folder. Shared folder is a directory in your host machine that is mounted to Docker instance.

  2. Put the exported sql file in the shared folder.

  3. Login to your Docker instance via docker exec -it DOCKER_CONTAINER_ID bin/bash.

  4. Login to MySQL via mysql -u USERNAME -p.

<?php
namespace Example\Doctrine\Util;
use Doctrine\ORM\Query;
class QueryUtils
{
/**
* @param Query $query
* @return array An array with 3 indexes, sql the SQL statement with parameters as ?, params the ordered parameters, and paramTypes as the types each parameter is.
@artemgordinskiy
artemgordinskiy / node-npm-in-docker.sh
Created December 11, 2015 14:00
Run Node/NPM in a Docker container
# For example, run "npm install"
docker run -v "$PWD":/usr/src/app -w /usr/src/app node:4 npm install
# This command creates a container (downloading one first if you don't have it locally), runs the command in a current directory and quits the container
# Great Success!
@mamchenkov
mamchenkov / monolog.php
Last active January 5, 2022 09:31
Example use of Monolog logger
<?php
// Before: composer require monolog/monolog
// composer autoloader
require_once 'vendor/autoload.php';
// Shortcuts for simpler usage
use \Monolog\Logger;
use \Monolog\Formatter\LineFormatter;
use \Monolog\Handler\StreamHandler;
@rkorkosz
rkorkosz / us_area_codes.json
Last active January 25, 2024 12:55
U.S. area codes json
{"Mississippi": [228, 601, 662, 769], "Northern Mariana Islands": [670], "Oklahoma": [405, 539, 580, 918], "Delaware": [302], "Minnesota": [218, 320, 507, 612, 651, 763, 952], "Illinois": [217, 224, 309, 312, 331, 618, 630, 708, 773, 779, 815, 847, 872], "Arkansas": [479, 501, 870], "New Mexico": [505, 575], "Indiana": [219, 260, 317, 574, 765, 812], "Maryland": [240, 301, 410, 443, 667], "Louisiana": [225, 318, 337, 504, 985], "Idaho": [208], "Wyoming": [307], "Tennessee": [423, 615, 731, 865, 901, 931], "Arizona": [480, 520, 602, 623, 928], "Iowa": [319, 515, 563, 641, 712], "Michigan": [231, 248, 269, 313, 517, 586, 616, 734, 810, 906, 947, 989], "Kansas": [316, 620, 785, 913], "Utah": [385, 435, 801], "American Samoa": [684], "Oregon": [458, 503, 541, 971], "Connecticut": [203, 475, 860], "Montana": [406], "California": [209, 213, 310, 323, 408, 415, 424, 442, 510, 530, 559, 562, 619, 626, 650, 657, 661, 669, 707, 714, 747, 760, 805, 818, 831, 858, 909, 916, 925, 949, 951], "Massachusetts": [339, 351, 413