Skip to content

Instantly share code, notes, and snippets.

@nuryagdym
nuryagdym / countries.sql
Created November 8, 2018 14:32 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@nuryagdym
nuryagdym / ykb-test-cards.txt
Created April 13, 2020 17:44
Yapıkredi Posnet test kredi kartları
Kart Numarası CVV SKT
4506 3470 4958 3145 000 24/05
4506 3470 2791 1094 000 24/12
5400 6170 2447 9160 000 24/11
4506 3441 3133 9098 000 21/02
@nuryagdym
nuryagdym / RolesType.php
Last active May 9, 2020 17:37 — forked from Glideh/RolesType.php
This is an example of how one could create a custom type for roles to add in a User form (Symfony v4.3 >)
<?php
namespace AdminBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Authorization\AuthorizationChecker;
use Symfony\Component\Security\Core\Role\RoleHierarchy;
@nuryagdym
nuryagdym / times.js
Last active June 12, 2021 06:37
Javascript Türkçe zaman birimleri
const translations = {
monthsFull: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'],
monthsShort: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'],
//first day is Monday
weekdaysFull: ['Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi', 'Pazar'],
weekdaysShort: ['Pzt', 'Sal', 'Çar', 'Per', 'Cum', 'Cmt', 'Paz'],
today: 'Bugün',
tomorrow: 'Yarın',
yesterday: 'Dün',
hour: 'saat',
@nuryagdym
nuryagdym / my_bootstrap_4_layout.html.twig
Created July 2, 2020 14:04
Symfony Form Builder Bootstrap 4 input-group Append and Prepend
{% use "bootstrap_4_layout.html.twig" %}
{# extend form_widget_simple #}
{% block form_widget_simple -%}
{%- if (prepend is defined) or (append is defined) -%}
<div class="input-group{{ group_class|default('') }}">
{%- if prepend is defined -%}
<div class="input-group-prepend">
{{ prepend|raw }} {# without raw filter the html code will be escaped #}
</div>
@nuryagdym
nuryagdym / Version20200508000000.php
Created July 20, 2020 11:05
Doctrine 2.x "Unknown database type enum, MySQL57Platform may not support it" fix
<?php
/**
* Symfony 4.4 migration file.
* add this file to src/migrations/ directory.
* github issue: https://github.com/doctrine/dbal/issues/3161
*/
declare(strict_types=1);
namespace DoctrineMigrations;
@nuryagdym
nuryagdym / LoginSubcriber.php
Last active November 2, 2021 15:02
Symfony 4.4 google captcha integration to login form using KarserRecaptcha3Bundle
<?php
namespace App\EventSubscriber;
use App\Form\LoginType;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;
@nuryagdym
nuryagdym / register.html.twig
Last active August 14, 2020 06:42 — forked from ThePeterMick/register.html.twig
Symfony 4 bootstrap 4 check box form label with link
{% form_theme form _self %}
{% block checkbox_radio_label -%}
{# {% block _user_registration_form_termsAccepted_label %} - use this if you need it for just a single field, amend accordingly to your form type/field #}
{#- Do not display the label if widget is not defined in order to prevent double label rendering -#}
{%- if widget is defined -%}
{% set is_parent_custom = parent_label_class is defined and ('checkbox-custom' in parent_label_class or 'radio-custom' in parent_label_class) %}
{% set is_custom = label_attr.class is defined and ('checkbox-custom' in label_attr.class or 'radio-custom' in label_attr.class) %}
{%- if is_parent_custom or is_custom -%}
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' custom-control-label')|trim}) -%}
@nuryagdym
nuryagdym / query-string-builder.ts
Last active January 29, 2021 12:41
Angular JSON object to query string
import {HttpParams} from "@angular/common/http";
export class QueryStringBuilder {
static buildParametersFromSearch<T>(obj: T): HttpParams {
let params: HttpParams= new HttpParams();
if (obj == null)
{
return params;
@nuryagdym
nuryagdym / Address.php
Last active June 20, 2021 09:17
How to use Symfony Serializer Component to Normalize Phalcon PHP models
<?php
namespace App\Model;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\MaxDepth;
use Doctrine\Common\Annotations\Annotation\IgnoreAnnotation;
/**
* @IgnoreAnnotation("Primary")
* @IgnoreAnnotation("Identity")