Skip to content

Instantly share code, notes, and snippets.

View keidarcy's full-sized avatar
🏖️
On vacation

Xing Yahao keidarcy

🏖️
On vacation
View GitHub Profile
@keidarcy
keidarcy / _button.sass
Created June 18, 2020 02:08
little sass
%btn
display: inline-block
border-radius: 5px
padding: 8px 20px
margin: 3px
&:hover
transform: scale(0.9)
.btn-primary
@keidarcy
keidarcy / index.md
Created June 17, 2020 06:36
display something when scroll and hide when others appear
<div id="side-cart-js">
  <template>
    <transition name="fade">
      <div @click="submitCart" class="btn-float-cart" v-show="isVisible">
        <img src="{{ 'cart-icon.svg' | asset_url }}" />
      </div>
    </transition>
  </template>
</div>
import React, { useState } from 'react'
import Counter from './Counter'
interface Props {
name: string
}
const HelloWorld: React.FC<Props> = ({ name }) => {
const [state] = useState < { fullname: string | null }>({fullname: ""})
return <div>hello {name}</div>
}
@keidarcy
keidarcy / regex.md
Last active June 14, 2020 01:31
regex

. - Any one character

* - Match any number of previous (including 0)

+ - Match any number of previous

$ - End of the line

^ - Begining of the line

@keidarcy
keidarcy / class.md
Created June 12, 2020 05:25
CSS Pseudo

EXAMPLE

button:hover{
  color: purple;
}

button:focus{
  color: green;
}
@keidarcy
keidarcy / class.js
Last active June 7, 2020 04:00
js function
class Book {
constructor(title, author, year) {
this.title = title
this.author = author
this.year = year
}
getAge = () => {
console.log(this)
const years = new Date().getFullYear() - this.year
return `${this.title} is published for ${years} years`
@keidarcy
keidarcy / index.md
Last active June 4, 2020 07:15
float side cart
  <template>
    <transition name="fade">
      <div @click="submitCart" class="btn-float-cart" v-show="isVisible">
        <img src="{{ 'cart-icon.svg' | asset_url }}" />
      </div>
    </transition>
  </template> 
@keidarcy
keidarcy / index.js
Created May 28, 2020 10:10
laravel-mix.js
const mix = require('laravel-mix')
mix.babelConfig({
plugins: ['@babel/plugin-proposal-class-properties']
})
mix
.react('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css')
.disableSuccessNotifications()
.version()
@keidarcy
keidarcy / update_scope.php
Last active May 26, 2020 09:06
Update OAuth scopes for Shopify app
<?php
// reference:https://shopify.dev/tutorials/authenticate-with-oauth
// This will redirect to app update page
// This is laravel version
$shop = YOUR_SHOP_DOMAIN;
$scopes = config('shopify-app.api_scopes');
$api_key = config('shopify-app.api_key');
// 'https://homestead.test/authenticate'
$redirect = AUTHENTICATE_URL_IN_PARNTER_PAGE;
$url = 'https://'. $shop .'.myshopify.com/admin/oauth/authorize?client_id='.$api_key.'&scope='.$scopes.'&redirect_uri='.$redirect;
@keidarcy
keidarcy / react-login.js
Last active May 16, 2020 04:14
login react vs vue
import React, { useState } from 'react'
const login = ({ username, password }) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
if (Object.is(username, 'bili') && Object.is(password, 'bili')) {
console.log(username, password)
resolve('success')
} else {
console.log(username, password)