Skip to content

Instantly share code, notes, and snippets.

View marinsagovac's full-sized avatar

Marin Sagovac marinsagovac

View GitHub Profile
In your github fork, you need to keep your master branch clean, by clean I mean without any changes, like that you can create at any time a branch from your master. Each time that you want to commit a bug or a feature, you need to create a branch for it, which will be a copy of your master branch.
When you do a pull request on a branch, you can continue to work on another branch and make another pull request on this other branch.
Before creating a new branch, pull the changes from upstream. Your master needs to be up to date.
Create the branch on your local machine and switch in this branch :
<pre>$ git checkout -b [name_of_your_new_branch]</pre>
@marinsagovac
marinsagovac / API PLATFORM - custom POST method
Last active March 2, 2018 09:31
API PLATFORM - custom POST method
HOW TO MAKE CUSTOM POST:
AppBundle/Controller/UserController.php:
<?php
namespace AppBundle\Controller;
use AppBundle\Entity\User;
# Find some custom route: bin/console debug:router
# example: api_countries_get_item
# Create a Controller/CountriesSpecial.php
<?php
namespace AppBundle\Controller;
@marinsagovac
marinsagovac / Vagrant + Kong
Last active April 5, 2018 13:09
Vagrant + Kong
"enabled_in_cluster": [# Vagrant
# Make sure that you are not listening ports that uses Vagrants:
lsof -i tcp:8000
Make sure that is some other port used is closed.
If uses then Vagrant boxes will not start
@marinsagovac
marinsagovac / map.geojson
Created February 19, 2018 12:49 — forked from walesmd/map.geojson
via:geojson.io
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@marinsagovac
marinsagovac / event.php
Created February 14, 2018 14:17
PHP TCP Server example
<?php
$serv=stream_socket_server("tcp://0.0.0.0:8000",$errno,$errstr) or die("create server failed");
$base = event_base_new();
$event = event_new();
function read_cb($socket, $flag, $base) {
fread($socket);
fwrite("hello world\n");
}
@marinsagovac
marinsagovac / Symfony JWT implementation
Last active January 26, 2018 12:53
Symfony JWT implementation
Ref: https://github.com/lexik/LexikJWTAuthenticationBundle
composer require lexik/jwt-authentication-bundle
Register in AppKernel:
public function registerBundles()
{
return array(
// ...
@marinsagovac
marinsagovac / gist:75718e0099b3e15628a11a1dfcb5f896
Created January 25, 2018 16:14
API Platform / generated from Schema.org
<?php
declare(strict_types=1);
namespace AppBundle\Entity;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
@marinsagovac
marinsagovac / API Platform Tests
Last active January 30, 2021 16:50
API Platform Tests
API PLATFORM
https://api-platform.com
https://github.com/api-platform/api-platform
### Install ###
composer create-project api-platform/api-platform bookshop-api
bin/console doctrine:database:create
bin/console server:run
@marinsagovac
marinsagovac / Redis Ubuntu PHP
Created January 18, 2018 10:19
Redis Ubuntu PHP
# Install Redis
sudo apt-get install redis-server
sudo apt-get install php-redis
sudo nano /etc/redis/redis.conf
Edit:
maxmemory 128mb