Skip to content

Instantly share code, notes, and snippets.

View jiahong96's full-sized avatar

Mike Loo jiahong96

View GitHub Profile
@jiahong96
jiahong96 / README.md
Created April 29, 2023 07:02
Documentation for Frontend Testing

Frontend testing

Automated tests help the team build complex Vue applications quickly and confidently by preventing regressions and encouraging you to break apart your application into testable functions, modules, classes, and components.

Tools

  1. Vitest - Unit testing framework
  2. jsdom - Testing environment
  3. @testing-library/vue - Library for querying and interacting with DOM nodes
  4. @testing-library/jest-dom - Provides a set of custom jest matchers
  5. @testing-library/user-event - Simulate the real events that would happen in the browser as the user interacts with it
@jiahong96
jiahong96 / DebouncedSearch.js
Created April 29, 2023 06:51
Debounced Search
import debounce from 'lodash-es/debounce'
// the search input onInput event binding to this method
// <input type="text" oninput="onSearchInput(this.value)">
const onSearchInput = (value) => {
debouncedSearch(value)
}
const debouncedSearch = debounce(function (value) {
@jiahong96
jiahong96 / .gitconfig
Last active January 5, 2024 02:40
My Git Aliases
[alias]
amd = commit --amend --no-edit
amdn = commit --amend --no-edit --no-verify
# stash with name
psth = stash push -m
co = checkout
p = push
pn = push --no-verify
br = branch
st = status
@jiahong96
jiahong96 / .php_cs
Created June 4, 2020 01:16
php cs fixer rules for Laravel
<?php
return PhpCsFixer\Config::create()
->setRules(array(
'@PSR2' => true,
'concat_space' => array('spacing' => 'none'),
'array_indentation' => true,
'no_unused_imports' => true,
'array_syntax' => array('syntax' => 'short'),
'combine_consecutive_unsets' => true,
'method_separation' => true,