Skip to content

Instantly share code, notes, and snippets.

View xphong's full-sized avatar
🎯
Focusing

Phong Huynh xphong

🎯
Focusing
View GitHub Profile
@xphong
xphong / d3-drag-and-drop.e2e.js
Last active June 23, 2020 09:08
Cypress D3 Svg Drag and Drop
const dataTransfer = new DataTransfer()
cy.window().then((win) => {
cy.get('.dragButton')
.trigger('mousedown', { which: 1, view: win, force: true })
cy.get('.dragButton')
.trigger('dragstart', { dataTransfer, view: win, force: true })
.trigger('drag', { dataTransfer, view: win, force: true })
cy.get('.dropElement')
.trigger('mouseenter', { force: true, view: win })
@xphong
xphong / .zshrc
Created October 4, 2018 15:43
Git alises
alias gcl='git clone'
alias ga='git add'
alias grm='git rm'
alias gap='git add -p'
alias gall='git add -A'
alias gf='git fetch --all --prune'
alias gft='git fetch --all --prune --tags'
alias gfv='git fetch --all --prune --verbose'
alias gftv='git fetch --all --prune --tags --verbose'
alias gus='git reset HEAD'
@xphong
xphong / App.vue
Created November 11, 2017 19:53
Marvel API + Vuepack (Vue + Vuex) Blog Post App Code
<template>
<div id="app">
<router-view></router-view>
</div>
</template>
<style>
@import url(https://fonts.googleapis.com/css?family=Lato);
body {
@xphong
xphong / Home.vue
Created November 11, 2017 19:50
Marvel API + Vuepack (Vue + Vuex) Blog Post Home Code
<template>
<div class="page">
<search-character-form></search-character-form>
<characters-list></characters-list>
</div>
</template>
<script>
import SearchCharacterForm from 'components/SearchCharacterForm'
import CharactersList from 'components/CharactersList'
@xphong
xphong / CharactersList.vue
Created November 11, 2017 19:35
Marvel API + Vuepack (Vue + Vuex) Blog Post CharactersList Code
<template>
<div v-if="!!characters.length" class="ui characters-list cards">
<div v-for="character in characters" :key="character.name" class="ui card fadeIn-animation">
<div class="image">
<img :src="character.image" />
</div>
<div class="content">
<div class="header">{{character.name}}</div>
<div class="description">
{{character.description}}
@xphong
xphong / SearchCharacterForm.vue
Created November 11, 2017 19:16
Marvel API + Vuepack (Vue + Vuex) Blog Post SearchCharacterForm Code
<template>
<div class="search-character__form">
<form @submit.prevent
@submit="handleSearch()">
<div class="ui action input">
<input v-model="name"
placeholder="Character Name"
type="text"
required />
@xphong
xphong / index.js
Created November 11, 2017 17:20
Marvel API + Vuepack (Vue + Vuex) Blog Post Store Code
import Vue from 'vue'
import Vuex from 'vuex'
import axios from 'axios'
Vue.use(Vuex)
const state = {
data: []
}
@xphong
xphong / index.html
Last active November 11, 2017 17:19
Marvel API + Vuepack (Vue + Vuex) Blog Post Code
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.6/semantic.min.css">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<div id="app"></div>
</body>
@xphong
xphong / extensions.md
Last active January 10, 2022 18:34
Visual Studio Code Extensions

Installed Packages

  • AutoFileName
  • Beautify
  • CSS Peek
  • ESLint
  • Git History
  • ES6 Snippets
  • JavaScript Snippets
  • One Dark Theme
@xphong
xphong / calculatorUtil.spec.js
Last active November 27, 2016 16:03
Simple Mocha Unit Test
'use strict';
const expect = require('chai').expect;
const CalculatorUtil = require('./CalculatorUtil');
describe('Calculator Util', () => {
let calculatorUtil;
beforeEach(() => {
calculatorUtil = new CalculatorUtil();