Docker

My Docker / docker-compose Notes

content is updated continuously. Useful commands for daily use:Build Docker: docker-compose build Run in background : docker-compose up -dFollow Docker Logs: docker-compose logs -f containeridGet Bash/SSH into a running Container: docker exec -it containerid bash Remove all stopped containers: docker rm $(docker ps -a -q) Views: 2

Development / PHP

Git Bash inside PhpStorm

Go to: File -> Settings -> Tools -> Terminal If you are using 64 Bit Git Bash(Git for Windows) put this in the Shell Path field. Or for 32 Bit Git Bash put this in the field Views: 9

PHP

PSR-2 PHP_CodeSniffer Config

# phpcs.xml, this file must be under project root folder. <?xml version=”1.0″?> <ruleset name=”Basic Project Coding Standards”> <rule ref=”PSR2″ /> <!– extra rules for the laugh 😉 LOL –> <rule ref=”Generic.CodeAnalysis.EmptyStatement” /> <rule ref=”Generic.Classes.DuplicateClassName”/> <rule ref=”Generic.CodeAnalysis.EmptyStatement”/> <rule ref=”Generic.CodeAnalysis.UnconditionalIfStatement”/> <rule ref=”Generic.CodeAnalysis.UnusedFunctionParameter”/> <rule ref=”Generic.CodeAnalysis.UselessOverridingMethod”/> <rule ref=”Generic.ControlStructures.InlineControlStructure”/> <rule ref=”Squiz.PHP.NonExecutableCode”/> <file>./src</file> <file>./test</file> </ruleset>   Views: 5

PHP

Travis CI for PHPUnit and PHP_CodeSniffer

# .travis.yml, this file must be under project root folder. language: php php: – 7.2 before_script: – composer self-update – composer install –prefer-source –no-interaction –dev script: – phpunit – ./vendor/bin/phpcs   Views: 3

PHP

PHPUnit Boilerplate

Of course first  phpunit/phpunit to be installed. I think, local installation much better. composer require –dev phpunit/phpunit ^7 # phpunit.xml <?xml version=”1.0″ encoding=”UTF-8″?> <phpunit backupGlobals=”false” backupStaticAttributes=”false” bootstrap=”vendor/autoload.php” colors=”true” convertErrorsToExceptions=”true” convertNoticesToExceptions=”true” convertWarningsToExceptions=”true” processIsolation=”false” stopOnFailure=”false”> <testsuites> <testsuite name=”Unit”> <directory suffix=”Test.php”>./tests</directory> </testsuite> </testsuites> <filter> <whitelist processUncoveredFilesFromWhitelist=”true”> <directory suffix=”.php”>./src</directory> </whitelist> </filter> </phpunit> # ExampleTest.php, this file must be under tests folder. (root/tests/ExampleTest.php) ?php namespace yourvendorname\yourpackagename; use PHPUnit\Framework\TestCase; /** * Description of ExampleTest * * @author Koray Zorluoglu <koray@d8devs.com> */ class ExampleTest extends TestCase { public function testExampleMethod() { $count = 0; $this->assertSame(0, $count); } } # Run on Command prompt. ./vendor/bin/phpunit # Example Output $ […]

Development / PHP

Social Poster – A Simple Facebook Page and Twitter poster

Social (Media) Poster Social Poster is a simple Facebook Page and Twitt poster Text Posting Text with Image-\s Posting Tech Social Poster uses a number of open source projects to work properly: facebook/graph-sdk – Facebook SDK for PHP (v5) dg/twitter-php – Twitter for PHP is a very small and easy-to-use library for sending messages to Twitter and receiving status updates. dillinger.io – Markdown editor for this readme.md creating/editing. Fast and easy to extend. Twitter Bootstrap – great UI boilerplate for modern web apps jQuery – duh Integration Facebook Create Facebook Developer Account Create Simple App You not need Facebook Products […]

Development / Javascript

How do Remove Element From an Array – Simple

/** Set – New Array */ const users = []; /** * Add – New Element/Item */ users.push({ id: socket.id, name: ‘Visitor’}); /** * Find – Index of Element */ var foundIndex = users.findIndex(x => x.id == socket.id); /** * Update/Add – New Data an Founded Element */ users[foundIndex].name = data.name; /** * Remove */ users.splice(foundeIndex, 1); Example from My Home Hobby Project: const users = []; nsp.on(‘connection’, (socket) => { console.log(‘Kullanici :’ + socket.id + ‘Baglandi’); users.push({ id: socket.id, name: ‘Visitor’}); socket.on(‘sendUserData’, (data) => { console.log(‘Server => ‘ + data.name + ‘ Connected.’); var foundIndex = users.findIndex(x => x.id […]

Development / PHP

My Experiences with Laravel 5.5

First Project / Look : I have had some experience in module writing my company software solution for an Aid Organization. This project was with Laravel 5.1, what the customer wants as a correction or update… What have I had? First of all, some pre-installed plugins(from the old developer at company) need to be updated, because these plugins work not nicely or stable.. But isn’t possible, because XYZ Plugin needed higher version another ABC, DEF Plugins, this plugin needed higher version of laravel/framework.  If I framework updated, then you get several errors, because main core functions or classes changed or […]

Development / Linux / PHP / Raspberry Pi Zero W / Server

Raspberry Pi Zero W + USB Modem – SMS Gateway

This Article updated on 08.09.2019 Install usb-modeswitch, smstools, wvdial sudo apt-get install usb-modeswitch usb-modeswitch-data smstools wvdial Find right device and baudrate with this command; sudo wvdialconf …my modem information (modem on ttyUSB1 and baudrate 9600)… ttyUSB0<*1>: ATQ0 V1 E1 — failed with 2400 baud, next try: 9600 baud ttyUSB0<*1>: ATQ0 V1 E1 — failed with 9600 baud, next try: 9600 baud ttyUSB0<*1>: ATQ0 V1 E1 — and failed too at 115200, giving up. ttyUSB1<*1>: ATQ0 V1 E1 — OK ttyUSB1<*1>: ATQ0 V1 E1 Z — OK ttyUSB1<*1>: ATQ0 V1 E1 S0=0 — ERROR ttyUSB1<*1>: ATQ0 V1 E1 &C1 — ERROR […]

Raspberry Pi Zero W

Raspbian Stretch Lite – Setup (Raspberry Pi Zero W)

Stretch Lite image Download Link: https://www.raspberrypi.org/downloads/raspbian/ Choose Raspbian Stretch Lite Download ZIP. Make unzip this downloaded zip file. The easiesst way to Flash to your SD Card is Etcher. Download and install this Software. After Openning, Select .iso file, and your SD Card and click Flash. How to set up WiFi Create a file in Boot directory called wpa_supplicant.conf ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev network={ ssid=”YOUR-NETWORK-NAME” psk=”PASSWORD” key_mgmt=WPA-PSK } How to enable SSH Create a file in Boot directory empty file called ssh. For example i have on my computer Git Bash Terminal, with this Terminal type only this command:   touch ssh or second […]

Docker

Docker for Local WordPress Development

Create a file  called docker-compose.yml with the following code in your project directory and then enter ‘docker-compose up’ at the command line. version: “2” services: my-wpdb: image: mariadb ports: – “8081:3306” environment: MYSQL_ROOT_PASSWORD: verysecret mywp: image: wordpress volumes: – ./:/var/www/html ports: – “8080:80” links: – my-wpdb:mysql environment: WORDPRESS_DB_PASSWORD: verysecret   Views: 3