Skip to content

Instantly share code, notes, and snippets.

View exileed's full-sized avatar
🎵
NP: North Star of Nija (Orbit Culture) (3:25/5:14)

Dmitriy Kuts exileed

🎵
NP: North Star of Nija (Orbit Culture) (3:25/5:14)
View GitHub Profile
@exileed
exileed / index.php
Last active March 20, 2017 20:07 — forked from anonymous/php
FuelingsController
<?php
namespace App\Http\Controllers\Vehicles;
use App\Helpers\CarbonFormatter;
use App\Http\Controllers\Controller;
use App\Models\Dictionaries\FuelType;
use App\Models\Vehicles\Fueling;
use App\Models\Vehicles\Car;
use Illuminate\Http\Request;
use Storage;
@exileed
exileed / select.sql
Created February 20, 2017 23:32
Select
select count( distinct user_id ) as n, d, dt from
(
select user_id,
z.zt as d,
G.dt
from
messages
cross join
( select distinct DATE_FORMAT( messages.date, '%Y-%m-%d') as zt from messages) z
inner join
@exileed
exileed / image.php
Created February 9, 2017 15:56
Image resize
<?php
$image = new class {
public width = null;
public height = null;
public function __construct($filename) {
list($width, $height) = getimagesize($filename);
$this->width = $width;
<?php
namespace App\Events\AddUserEvent;
use Illuminate\Queue\SerializesModels;
class AddUserEvent
{
use SerializesModels;
<?php
interface ClientInterface{
// mentods
public link():string;
}
class ClientServer1 implements ClientInterface{
@exileed
exileed / Factory.php
Created December 1, 2016 04:16 — forked from tkouleris/Factory.php
Factory Design Pattern example
<?php
/*
*
* Factory Design Pattern
* -----------------------
* Wiki: In class-based programming, the factory method pattern is a creational pattern that uses factory methods to deal with the problem of creating
* objects without having to specify the exact class of the object that will be created. This is done by creating objects by calling a factory
* method—either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived
* classes—rather than by calling a constructor.
$bytesCopied = stream_copy_to_stream($source, $target);
fclose($source);
fclose($target);
unset($source, $target);
if (!is_file($targetFile)) {
throw new Exception('');
}
if($bytesCopied !== filesize($originFile)){

Напутствие

Тестирование Ангуляр приложений может строится на разных стеках, будем считать, что вы работаете с "самым правильным". Итак:

  • для юнит тестирование используется karma - бывший Testacular (который был переназван из-за хая, поднятого феменистками). В core-team есть разработчики ангуляра, поэтому часто называют карму продуктом команды ангуляра. Ранит ваши тесты или в бразуере, или в консоли (behind the scenes используя phantomjs - фантом).
  • для e2e (end-to-end) тестирование раньше предлагалось использовать karma-scenario, сейчас ангуляровцы предлагают использовать protractor - враппер (и немного утилсов для настройки) над селениумом.

Материалы

Много буков

[http://www.yearofmoo.com/2013/01/full-spectrum-testing-with-angularjs-and-karma.html](http://www.yearofmoo.com/2013/01/full-spectrum-testing-with

upstream staticcontent {
server myserv-1.local;
server myserv-2.local;
}
server {
location ~* \.(ico|js|css|png|gif|jpe?g|swf|txt|html?|htc)$ {
expires 7d;
proxy_next_upstream error timeout invalid_header http_500 updating;

Keybase proof

I hereby claim:

  • I am exileed on github.
  • I am exileed (https://keybase.io/exileed) on keybase.
  • I have a public key whose fingerprint is D510 7F48 75BC F678 CA29 1C4A 253F 2C6D DE5A FCD5

To claim this, I am signing this object: