Skip to content

Instantly share code, notes, and snippets.

View rslhdyt's full-sized avatar
🎯
Focusing

Risal Hidayat rslhdyt

🎯
Focusing
View GitHub Profile
@rslhdyt
rslhdyt / App.vue
Last active November 30, 2019 06:25
[watch nested data] vue js watch nested data #vuejs #javascript #vuewatch
<script>
export default {
data: () => ({
form: {
id: 1
text: 'ABC'
}
}),
watch:{
'form.id': function (newVal, oldVal){
@rslhdyt
rslhdyt / test_rspec.rb
Last active March 11, 2019 10:19
Rspec Race Conditions
describe 'Race condition POST /api/v1/transaction/electricity', vcr: { cassette_name: 'race_condition_transaction_electricity' } do
it { expect(ActiveRecord::Base.connection.pool.size).to eq(5) }
context 'send requests simultaneously' do
let!(:user) { create(:user, limit_credit: 500_000, balance: 60_000) }
it 'should create one transaction' do
begin
concurrency_level = 4
fail_occurred = false
@rslhdyt
rslhdyt / FormGroupInput.vue
Created March 16, 2019 06:11
[Form Group Component] Vuejs form group component wrapper using bootstrap-vue and vee-validate #vuejs #validation #bootstrap
<template>
<ValidationProvider :rules="rules" :name="$attrs.label">
<b-form-group slot-scope="{ valid, errors }" :label="$attrs.label" :invalid-feedback="errors[0]">
<b-input
:state="errors[0] ? false : (valid ? true : null)"
:name="$attrs.label.toLowerCase()"
:type="$attrs.type"
:placeholder="$attrs.placeholder"
v-model="innerValue" />
</b-form-group>
@rslhdyt
rslhdyt / DepositTest.php
Created April 20, 2019 16:41
[Mock Koperasi Api Request] example mocking koperasi io request #mocking #phpunit #laravel
<?php
...
/**
* A basic test example.
*
* @return void
*/
public function testSearchPageResult()
@rslhdyt
rslhdyt / Customer.php
Created April 29, 2019 03:30
[Searchable Traits] Simple searchable traits for laravel model #laravel #search #simpleSearch #traits
<?php
namespace App\Models;
use App\Models\Traits\Searchable;
use Illuminate\Database\Eloquent\Model;
class Customer extends Model
{
use Searchable;
@rslhdyt
rslhdyt / disable_only_full_group_by.sql
Created May 24, 2019 11:51
[Disable only_full_group_by mysql] How to disable only_full_group_by in mysql 5.* #mysql #troubleshooting #setup
set global sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
set session sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
@rslhdyt
rslhdyt / AppServiceProvider.php
Last active June 25, 2019 03:28
[Socialite Custom Driver Test] Mock socialite with custom driver #laravel #php #socialite #mock #phpunit
// app/Providers/AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use App\Services\FooApp\FooAppSocialite;
class AppServiceProvider extends ServiceProvider
@rslhdyt
rslhdyt / DateFormater.php
Last active September 12, 2019 16:29
[Date Mutator] Traits helper to format date object #laravel #php #traits
<?php
namespace App\Models\Traits;
use Carbon\Carbon;
trait DateFormater
{
public function appDate($attribute, $format = null)
{
@rslhdyt
rslhdyt / pos.vue
Created February 1, 2020 05:12
POS
<div>
<div class="container-fluid">
<div class="row">
<div class="col-md-8">
<b-card class="mb-3">
<b-form inline>
<label class="sr-only" for="inline-form-input-username">Cari Produk</label>
<b-input-group class="mb-2 mr-sm-2 mb-sm-0" size="lg" style="width: 50%">
<b-input id="search-product" placeholder="Cari produk..."></b-input>
<b-input-group-append>
@rslhdyt
rslhdyt / filter_parameter_logging.rb
Created June 9, 2021 10:52
Manually filter parameters or hash based on filter parameter logging config in ruby on rails application
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += %i[
passw password vendorable_id
]