Skip to content

Instantly share code, notes, and snippets.

View marinsagovac's full-sized avatar

Marin Sagovac marinsagovac

View GitHub Profile
@marinsagovac
marinsagovac / Country.json
Created March 20, 2018 14:33
Country.json
{"results":[{"id":"1","iso":"AF","name":"AFGHANISTAN","nicename":"Afghanistan","iso3":"AFG","numcode":"4","phonecode":"93"},{"id":"2","iso":"AL","name":"ALBANIA","nicename":"Albania","iso3":"ALB","numcode":"8","phonecode":"355"},{"id":"3","iso":"DZ","name":"ALGERIA","nicename":"Algeria","iso3":"DZA","numcode":"12","phonecode":"213"},{"id":"4","iso":"AS","name":"AMERICAN SAMOA","nicename":"American Samoa","iso3":"ASM","numcode":"16","phonecode":"1684"},{"id":"5","iso":"AD","name":"ANDORRA","nicename":"Andorra","iso3":"AND","numcode":"20","phonecode":"376"},{"id":"6","iso":"AO","name":"ANGOLA","nicename":"Angola","iso3":"AGO","numcode":"24","phonecode":"244"},{"id":"7","iso":"AI","name":"ANGUILLA","nicename":"Anguilla","iso3":"AIA","numcode":"660","phonecode":"1264"},{"id":"8","iso":"AQ","name":"ANTARCTICA","nicename":"Antarctica","iso3":"ATA","numcode":"010","phonecode":"0"},{"id":"9","iso":"AG","name":"ANTIGUA AND BARBUDA","nicename":"Antigua and Barbuda","iso3":"ATG","numcode":"28","phonecode":"1268"},{"id":
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
Loading
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