Skip to content

Instantly share code, notes, and snippets.

View kix's full-sized avatar

Stepan Anchugov kix

View GitHub Profile

Native mocks versus PHPUnit mocks

Mock type Tests duration
Native mocks 160.10 seconds
Mockery 177.01 seconds (+10%)
PHPUnit mocks 232.29 seconds (+45%)
Prophecy 3868.80 seconds (+2416%)
@florentdestremau
florentdestremau / NewPasswordType.php
Last active March 10, 2023 13:17
A simple User authentication setup to copy & paste into your Symfony 3.4 install
<?php
namespace AppBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
@joshdover
joshdover / README.md
Last active September 28, 2023 21:38
Idiomatic React Testing Patterns

Idiomatic React Testing Patterns

Testing React components seems simple at first. Then you need to test something that isn't a pure interaction and things seem to break down. These 4 patterns should help you write readable, flexible tests for the type of component you are testing.

Setup

I recommend doing all setup in the most functional way possible. If you can avoid it, don't set variables in a beforeEach. This will help ensure tests are isolated and make things a bit easier to reason about. I use a pattern that gives great defaults for each test example but allows every example to override props when needed:

Ок. У нас сегодня последняя большая тема, в выходные будет формат полегче. Перед тем как к ней переходить несколько тезисов из прошлых дней:

  1. Я считаю что модель верстки компонентами для любого крупного проекта подходит лучше, чем любай другая.
  2. Компонент включает HTML, CSS, JS, тесты, локализации, мануал и т. д. Эти файлы проще всего хранить и использовать вместе.
  3. Браузер это ассемблер которому мы кормим оптимизированный машинный код в разных форматах.
  4. CSS, JS и HTML должны знать структуру друг друга, это позволяет гораздо эффективнее их сокращать, пожимать и оптимизировать.

Использование в последние годы штук вроде Webpack, React и CSS Modules меня лично убедило что при таком подходе к коду жить проще и приятнее.

Это все хорошо пока ты делаешь SPA, но есть проекты которым противопаказано быть SPA, а пользы от компонентов и оптимизаций было бы много.

@imjasonh
imjasonh / markdown.css
Last active February 12, 2024 17:18
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@generalov
generalov / gitconfig
Created September 5, 2014 13:16
gitconfig
[user]
name = Evgeny V. Generalov
email = e.generalov@gmail.com
[alias]
st = status
ci = commit
co = checkout
wc = diff --staged
br = branch
@h4cc
h4cc / Makefile
Last active July 4, 2017 23:35
Ubuntu 14.04 LTS Trusty Tahr - Basic packages i usually install
#
# Ubuntu 14.04 LTS (Trusty Tahr)
#
# Basic packages i usually install
#
# Author: Julius Beckmann <github@h4cc.de>
#
# For 16.04 Xenial Xerus: https://gist.github.com/h4cc/fe48ed9d85bfff3008704919062f5c9b
#
@johnkary
johnkary / satis.json
Last active December 21, 2015 11:59
satis.json config file for setting up a local mirror of common Symfony2 dependencies
{
"name": "My Project",
"homepage": "http://satis",
"output-dir": "web",
"repositories": [
{ "type": "vcs", "url": "https://github.com/symfony/symfony" },
{ "type": "vcs", "url": "https://github.com/symfony/Icu" },
{ "type": "vcs", "url": "https://github.com/doctrine/common" },
{ "type": "vcs", "url": "https://github.com/php-fig/log" },
{ "type": "vcs", "url": "https://github.com/doctrine/inflector" },
@johnkary
johnkary / default.rb
Last active October 7, 2016 21:52 — forked from philsturgeon/default.rb
Using PHP 5.4 on Ubuntu 12.04.
# Can force this into php/recipes/package.rb
# Or if you're like me and use a cookbook to provision with chef-solo...
# add this near the top of your file before you update apt
# Use PHP 5.4
apt_repository "php54" do
uri "http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu"
distribution node['lsb']['codename']
components ["main"]
keyserver "keyserver.ubuntu.com"