Skip to content

Instantly share code, notes, and snippets.

View mysiar's full-sized avatar
🌐
Working remotely

Piotr Synowiec mysiar

🌐
Working remotely
View GitHub Profile
@mysiar
mysiar / remove element from array
Last active September 1, 2016 07:10
remove element from array
/**
* callback for array_filter to get array without element with $id
*/
class idNotEqual {
private $id;
function __construct($id) {
$this->id = $id;
}
public function del_slow($id) {
$offset = 0;
foreach ($this->products as $p) {
if ($p->getId() == $id) {
array_splice($this->products, $offset, 1);
break;
}
$offset++;
}
}
@mysiar
mysiar / classBowlingGame.php
Created September 20, 2016 05:10
Bowling Game
class BowlingGame {
private $rolls = array();
private $currentRoll = 0;
public function __construct() {
for ($i = 0; $i < 21; $i++) {
$this->rolls[$i] = 0;
}
}
@mysiar
mysiar / PDO database connection Class with single static method
Last active December 11, 2021 17:22
PDO database connection Class with single static method
// dbconfig.json
{
"server": "localhost",
"dbname": "cl_shop",
"user" : "root",
"pass" : "root"
}
// class definition
class DB {
@mysiar
mysiar / CachedEntityRepository.php
Last active June 10, 2017 10:42
Result Cached Entity Rpository
moved
@mysiar
mysiar / Coding Convention.txt
Last active September 19, 2017 17:15
Coding Convention
╔═══════════════════════╦═════════════╦════════════╦══════════════╦════════════╦════════════╗
║ PHP Project ║ Classes ║ Methods ║ Properties ║ Functions ║ Variables ║
╠═══════════════════════╬═════════════╬════════════╬══════════════╬════════════╬════════════╣
║ Akelos Framework ║ PascalCase ║ camelCase ║ camelCase ║ lower_case ║ lower_case ║
║ CakePHP Framework ║ PascalCase ║ camelCase ║ camelCase ║ camelCase ║ camelCase ║
║ CodeIgniter Framework ║ Proper_Case ║ lower_case ║ lower_case ║ lower_case ║ lower_case ║
║ Concrete5 CMS ║ PascalCase ║ camelCase ║ camelCase ║ lower_case ║ lower_case ║
║ Doctrine ORM ║ PascalCase ║ camelCase ║ camelCase ║ camelCase ║ camelCase ║
║ Drupal CMS ║ PascalCase ║ camelCase ║ camelCase ║ lower_case ║ lower_case ║
║ Joomla CMS ║ PascalCase ║ camelCase ║ camelCase ║ camelCase ║ camelCase ║
@mysiar
mysiar / react-native-elements.js
Created September 30, 2017 07:25
React Native Elements
const SocialIcons =
[
"glass",
"music",
"search",
"envelope-o",
"heart",
"star",
"star-o",
"user",
@mysiar
mysiar / OSX-Kodi-Netflix.md
Created January 12, 2018 13:01
OSX Netflix on Kodi
@mysiar
mysiar / Symfony_PostGIS.md
Last active January 24, 2018 07:58
Symfony PostGIS

Symfony & PostGIS

#app/config/config.yml
...
doctrine:
    dbal:
        ...
        types:
 geography: 'Jsor\Doctrine\PostGIS\Types\GeographyType'
@mysiar
mysiar / symfony_4_xml_services.xml
Created February 23, 2018 12:42
Symfony 4 Service XML defintions
<services>
<!--REPOSITORY-->
<service id="test.provider_low_level_config_repository" class="mysiar\AppBundle\Repository\ConfigRepository">
<factory service="doctrine.orm.entity_manager" method="getRepository" />
<argument type="string">mysiar\AppBundle\Entity\Config</argument>
</service>
</services>