Skip to content

Instantly share code, notes, and snippets.

View fysherman's full-sized avatar
🍒
cherry

Duy Khanh Bui fysherman

🍒
cherry
  • Viet Nam
  • 16:28 (UTC +07:00)
View GitHub Profile
function loginFb() {
if (!window.FB) return;
let fbToken = null;
function loginMethod(response) {
if (response.authResponse) {
if (response.authResponse.accessToken) {
fbToken = response.authResponse.accessToken;
const res = await $axios.$get(`https://graph.facebook.com/${response.authResponse.userID}?fields=id,first_name,last_name,email,picture,location&access_token=${fbToken}`);
@fysherman
fysherman / gg-signin-button.js
Created October 26, 2021 15:23
Google signin button
// Function handle data response from sigin in action, use jwt to decode data
function handleCredentialResponse(response) {
const responseDecode = jwt_decode(response.credential);
}
function initGGAuth() {
google.accounts.id.initialize({
client_id: CLIENT_ID,
callback: handleCredentialResponse
});
google.accounts.id.renderButton(
@fysherman
fysherman / is-function.js
Created October 26, 2021 15:19
Check if data is a function
function isFunction(obj) {
return obj && {}.toString.call(obj) === '[object Function]';
}
// Check if device is mobile
function isMobileDevice() {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent);
}
// Check if device is touchable
function isTouchDevice() {
return 'ontouchstart' in document.documentElement;
}
@fysherman
fysherman / overflow-hidden-with-animation.css
Created October 26, 2021 15:14
Safari: Apply overflow hidden on parent element when its child is running animation
.parent {
overflow: hidden;
backface-visibility: hidden;
transform: translate3d(0, 0, 0);
}
.child {
/* Has animation */
}