Skip to content

Instantly share code, notes, and snippets.

View adamsafr's full-sized avatar
🏠

Adam Sapraliev adamsafr

🏠
View GitHub Profile
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
<?php
namespace Acme\Serializer\Normalizer;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use Symfony\Component\Serializer\Normalizer\SerializerAwareNormalizer;
@codedokode
codedokode / ВСстированиС.md
Last active May 5, 2025 08:24
АвтоматизированноС тСстированиС

АвтоматизированноС тСстированиС

ΠžΠ±Ρ‹Ρ‡Π½ΠΎ послС написания ΠΊΠΎΠ΄Π° Π΅Π³ΠΎ ΠΏΡ€ΠΎΠ²Π΅Ρ€ΡΡŽΡ‚. Если Ρ€Π΅Ρ‡ΡŒ ΠΎ ΠΊΠ°ΠΊΠΎΠΉ-Ρ‚ΠΎ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΈ, Ρ‚ΠΎ ΠΌΠΎΠΆΠ½ΠΎ Π½Π°ΠΏΠΈΡΠ°Ρ‚ΡŒ простой скрипт, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ Π±ΡƒΠ΄Π΅Ρ‚ Π²Ρ‹Π·Ρ‹Π²Π°Ρ‚ΡŒ Π΅Π΅ с Ρ€Π°Π·Π½Ρ‹ΠΌΠΈ Π°Ρ€Π³ΡƒΠΌΠ΅Π½Ρ‚Π°ΠΌΠΈ, ΠΈ ΡΠΌΠΎΡ‚Ρ€Π΅Ρ‚ΡŒ, Ρ‡Ρ‚ΠΎ ΠΎΠ½Π° Π²Π΅Ρ€Π½Π΅Ρ‚. Если Π²Ρ‹ сдСлали сайт ΠΈΠ»ΠΈ ΠΏΡ€ΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅, Ρ‚ΠΎ Π²Ρ‹ ΠΎΡ‚ΠΊΡ€Ρ‹Π²Π°Π΅Ρ‚Π΅ Π΅Π³ΠΎ, ΠΆΠΌΠ΅Ρ‚Π΅ ссылки ΠΈ ΠΊΠ½ΠΎΠΏΠΊΠΈ, провСряСтС Ρ‡Ρ‚ΠΎ всС отобраТаСтся Π²Π΅Ρ€Π½ΠΎ. Π­Ρ‚ΠΎ называСтся Ρ€ΡƒΡ‡Π½ΠΎΠ΅ тСстированиС ΠΈΠ»ΠΈ QA (Quality Assurance β€” ΠΊΠΎΠ½Ρ‚Ρ€ΠΎΠ»ΡŒ качСства) β€” Ρ‡Π΅Π»ΠΎΠ²Π΅ΠΊ провСряСт Ρ€Π°Π±ΠΎΡ‚Ρƒ ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΡ‹. Если ΠΌΡ‹ ΠΏΠΎΠΏΡ€ΠΎΠ±ΡƒΠ΅ΠΌ Π°Π²Ρ‚ΠΎΠΌΠ°Ρ‚ΠΈΠ·ΠΈΡ€ΠΎΠ²Π°Ρ‚ΡŒ этот процСсс, ΠΈ Π½Π°ΠΏΠΈΡΠ°Ρ‚ΡŒ ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΡƒ, которая провСряСт ΠΏΡ€Π°Π²ΠΈΠ»ΡŒΠ½ΠΎΡΡ‚ΡŒ Π΄Ρ€ΡƒΠ³ΠΎΠΉ ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΡ‹, Ρ‚ΠΎ это называСтся Π°Π²Ρ‚ΠΎΠΌΠ°Ρ‚ΠΈΠ·ΠΈΡ€ΠΎΠ²Π°Π½Π½ΠΎΠ΅ тСстированиС.

Π“Π»Π°Π²Π½Ρ‹ΠΉ плюс автоматичСских тСстов β€” Ρ‚ΠΎ, Ρ‡Ρ‚ΠΎ ΠΎΠ½ΠΈ Π²Ρ‹ΠΏΠΎΠ»Π½ΡΡŽΡ‚ΡΡ Π½Π°ΠΌΠ½ΠΎΠ³ΠΎ быстрСС, Ρ‡Π΅ΠΌ Ρ€ΡƒΡ‡Π½ΠΎΠ΅ тСстированиС, ΠΈ Π²Π°ΠΌ Π½Π΅ Π½Π°Π΄ΠΎ Ρ‚Ρ€Π°Ρ‚ΠΈΡ‚ΡŒ Π½Π° это своС врСмя (ΠΈΠ»ΠΈ врСмя тСстировщика). Π­Ρ‚ΠΎ позволяСт Π·Π°ΠΏΡƒΡΠΊΠ°Ρ‚ΡŒ ΠΈΡ… Ρ…ΠΎΡ‚ΡŒ послС ΠΊΠ°ΠΆΠ΄ΠΎΠ³ΠΎ измСнСния Π² ΠΊΠΎΠ΄Π΅.

Π’Π°ΠΊΠΆΠ΅, тСсты ΠΏΠΎΠ·Π²ΠΎΠ»ΡΡŽΡ‚ Β«Π·Π°Ρ‰ΠΈΡ‚ΠΈΡ‚ΡŒΒ» написанный ΠΊΠΎΠ΄. Если ΠΊΡ‚ΠΎ-Ρ‚ΠΎ Π² ΠΊΠΎΠΌΠ°Π½Π΄Π΅ (ΠΈΠ»ΠΈ Π²Ρ‹ сами) нСчаянно «сломал» ваш ΠΊΠΎΠ΄, тСсты это ΠΎΠ±Π½Π°Ρ€ΡƒΠΆΠ°Ρ‚ ΠΈ ΡƒΠΊΠ°ΠΆΡƒΡ‚, Ρ‡Ρ‚ΠΎ ΠΈΠΌΠ΅Π½Π½

@maximecolin
maximecolin / LoadData.php
Last active December 17, 2020 10:51
Faker uploaded file provider
<?php
namespace Acme\DemoBundle\Fixtures\ORM;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Nelmio\Alice\Fixtures;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Security\Core\User\UserInterface;
@sergiotapia
sergiotapia / md5-example.go
Last active May 9, 2025 15:39
Golang - How to hash a string using MD5.
import (
"crypto/md5"
"encoding/hex"
)
func GetMD5Hash(text string) string {
hasher := md5.New()
hasher.Write([]byte(text))
return hex.EncodeToString(hasher.Sum(nil))
}
@rxaviers
rxaviers / gist:7360908
Last active May 14, 2025 17:39
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue:
@kibao
kibao / ApiUploadedFile.php
Last active February 22, 2022 15:14
Symfony2 Form Component. Support upload file through API call (e.g. in json, xml, etc.) as base64 encoded content .
<?php
namespace Infun\HttpFoundation\File;
use Symfony\Component\HttpFoundation\File\File;
class ApiUploadedFile extends File
{
public function __construct($base64Content)
@zdne
zdne / mutlipart-example
Last active March 25, 2021 03:44
API Blueprint multipart request example. Raw HTTP source: http://chxo.com/be2/20050724_93bf.html.
# POST /path/to/script.php
+ Request (multipart/form-data, boundary=AaB03x)
+ Headers
Content-Length: $requestlen
+ Body
@bjo3rnf
bjo3rnf / EntityHiddenType.php
Last active November 19, 2021 17:19
Hidden field for Symfony2 entities
<?php
namespace Dpn\ToolsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Dpn\ToolsBundle\Form\DataTransformer\EntityToIdTransformer;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Doctrine\Common\Persistence\ObjectManager;
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter