Skip to content

Instantly share code, notes, and snippets.

View szabacsik's full-sized avatar
🖖

András Szabácsik szabacsik

🖖
View GitHub Profile
@szabacsik
szabacsik / date-time.php
Last active November 16, 2021 13:56
Date & Time
<?php
declare(strict_types=1);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
class time
{
public function now ( $format = "Y-m-d H:i:s.u" )
{
@szabacsik
szabacsik / apache.conf
Last active January 23, 2018 10:27
Apache HTTP Server Configuration File for Docker Containerized Applications
#Apache HTTP Server Configuration File for Docker Containerized Applications
LogLevel debug
ErrorLog /proc/self/fd/2
CustomLog /proc/self/fd/1 combined
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /attached/artifact/public
LogLevel debug
@szabacsik
szabacsik / index.php
Created November 22, 2017 15:24
Hello World PHP script to testing my Ubuntu Apache PHP Docker Container
<?php
phpinfo();
@szabacsik
szabacsik / php.ini
Last active January 25, 2018 10:42
Additional php.ini file set in PHP_INI_SCAN_DIR environment variable, will be cloned on build and parsed from docker volume
display_startup_errors = On
display_errors = On
error_reporting = E_ALL
log_errors = On
max_input_time = 30
max_execution_time = 30
memory_limit = 256M
post_max_size = 25M
upload_max_filesize = 50M
date.timezone = "UTC"
@szabacsik
szabacsik / composer.md
Last active September 3, 2021 14:30
Composer
{
    "type": "project",
    "license": "proprietary",
    "autoload":
    {
        "psr-4":
        {
            "App\\": "src/"
        }
@szabacsik
szabacsik / index.html
Created December 15, 2017 15:53
Blank HTML5 template with Bootstrap and JQuery framework
<!doctype html>
<html lang="en">
<head>
<title>Blank HTML5 template with Bootstrap and JQuery framework</title>
<meta charset="utf-8">
<meta name="description" content="Blank HTML5 template with Bootstrap and JQuery framework">
<meta name="author" content="András Szabácsik">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600,800&amp;subset=latin-ext" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
@szabacsik
szabacsik / raw_post.php
Created January 8, 2018 14:18
Get raw data from the request body
$json_string = file_get_contents ( 'php://input' );
$object = json_decode ( $json_string );
var_export ( $object );
//http://php.net/manual/en/wrappers.php.php
//https://stackoverflow.com/questions/2731297/file-get-contentsphp-input-or-http-raw-post-data-which-one-is-better-to
@szabacsik
szabacsik / docker-commands.md
Last active March 6, 2024 10:42
Docker Commands

Start MySql database with Apache/PHP and phpMyAdmin

docker run --name mysql -d -e MYSQL_ROOT_PASSWORD=PASSWORD -e MYSQL_ROOT_HOST=% -p 3306:3306 mysql/mysql-server:latest
docker run --name phpmyadmin -d --link mysql:db -p 8080:80 phpmyadmin/phpmyadmin:latest
docker run --name php -d --link mysql:db -p 80:80 php:apache
docker exec php bash -c "echo \"<?php phpinfo();\" >> /var/www/html/index.php"

Stop all running containers

@szabacsik
szabacsik / slack.php
Created January 29, 2018 12:07
slack php function
<?php
define ( 'SLACK_WEBHOOK', 'https://hooks.slack.com/services/' );
function slack ( $message, $username, $channel )
{
switch ( $channel )
{
case 'delivery-form':
$token = '...';
break;
}
@szabacsik
szabacsik / slack.sh
Created April 6, 2018 09:55
Post a message to a Slack channel with Curl
curl -X POST --data-urlencode "payload={\"channel\": \"#CHANNEL\", \"username\": \"USERNAME\", \"text\": \"MESSAGE\", \"icon_emoji\": \":frog:\"}" https://hooks.slack.com/services/TOKEN