Skip to content

Instantly share code, notes, and snippets.

View asvae's full-sized avatar

Yauheni Prakopchyk asvae

View GitHub Profile
@asvae
asvae / suggest-node-testing.md
Created August 6, 2017 11:09
Suggesting node testing

We suggest to use node.js for api integration tests.

Upsides

  • Code sharing between frontend and testers (Entity (sctructure + bound logic), Factory, Mapper).
  • Filling the test-coverage gap between backend and frontend. Currently this is the most untested and dangerous part.
  • Node is better than php to work with dynamic data structures.
  • Making frontend guys happy as our burden will be lightened.

Downsides

  • Testers should have to learn JS. Though tests don't pose much a difficulty.
@asvae
asvae / TimePicker.vue
Created July 17, 2017 19:41
Time picker on vue 2 (stateful computed property example)
<template>
<div>
<vm-clock
v-if="! showMinutes"
type="hours"
v-model="hours"
@input="showMinutes = true"
>
<vm-am-pm-switch v-model="amPm"/>
</vm-clock>
@asvae
asvae / FixUserRoles.php
Created July 12, 2017 13:59
Laravel database fixture example
<?php
namespace Upping\Console\Commands;
use Bican\Roles\Models\Role;
use Illuminate\Console\Command;
use Upping\Models\User;
use Upping\Repositories\UserRepository;
class FixUserRoles extends Command
@asvae
asvae / countryStore.js
Last active July 3, 2017 15:23
Country store
import CountryRepository from '../classes/Api/CountryRepository.js'
import Country from "../classes/Domain/Entity/Country";
export default {
_isInitialized: false,
_countries: [],
get countries (): Array<Country> {
if (!this._isInitialized) {
this._isInitialized = true
@asvae
asvae / executor.js
Last active May 18, 2023 12:08
Executor pattern
// Class
export default class Executor {
command: Function
wasLastRunFine: Boolean = false
runCount: Number = 0 // Currently active commands count
wasRun: Boolean = false
wasRunFine: Boolean = false
wasRunBad: Boolean = false
@asvae
asvae / array_delete.js
Created May 25, 2017 10:30
array delete function with tests
/**
* Remove item from array via identity check.
*
* @param array
* @param item
* @returns {[*]}
*/
static remove (array: Array, item) {
const result = [...array]
@asvae
asvae / convertBYRToBYN.php
Last active February 13, 2017 12:13
Laravel BYR to BYN currency converter command
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class ConvertBYRToBYN extends Command
{
protected $signature = 'convert-byr-to-byn';
@asvae
asvae / compare_laravel_and_doctrine_migrations.md
Last active November 13, 2020 18:43
Compare laravel and doctrine migrations

Let’s compare Laravel and Doctrine migrations

Laravel vs Doctrine

This article is targeted on Laravel beginners. No skills required whatsoever. Article is a tad opinionated, so take it with a grain of salt. Also, details are omitted for the sake of brevity.

In this article I will do the actual comparison as well as give several hints to get started.

If you’ve never heard of Doctrine, it is database abstraction layer. Sorta like Eloquent, but different type: Laravel is active record (AR), while Doctrine is object relational mapper (ORM).

Laravel migrations (docs)

@asvae
asvae / infinite-scroll.vue
Created July 20, 2016 18:29
vue.js infinite scroll component WIP
<template>
<div>
<pre v-text="$data | json"></pre>
</div>
</template>
<script>
export default {
data (){
return {
@asvae
asvae / vue-multiselect-typeahead
Created July 8, 2016 15:52
vue-multiselect-typeahead
<template>
<div class="ajax-select" :class="{'default': ! isTouched}">
<multiselect
:options="options"
:selected.sync="selected"
:multiple="false"
:placeholder="placeholder"
:on-search-change="fetchData"
key=""
:label="label"