Skip to content

Instantly share code, notes, and snippets.

@cuduy197
cuduy197 / index.html
Last active March 26, 2022 20:51
Firebase google Auth
<!DOCTYPE html>
<!--
Copyright (c) 2016 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@cuduy197
cuduy197 / index.html
Created March 18, 2017 23:08
Firebase email auth
<!DOCTYPE html>
<!--
Copyright (c) 2016 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@cuduy197
cuduy197 / districts_vn.json
Created October 6, 2017 23:17
Danh sách Tỉnh/Thành phố và quận huyện tại Việt Nam , theo trang http://gis.chinhphu.vn/.
{"1":{"name":"Thành phố Cần Thơ","districts":{"66":"Huyện Cờ Đỏ","67":"Huyện Phong Điền","68":"Huyện Thới Lai","69":"Huyện Vĩnh Thạnh","70":"Quận Bình Thủy","71":"Quận Cái Răng","72":"Quận Ninh Kiều","73":"Quận Ô Môn","74":"Quận Thốt Nốt"}},"2":{"name":"Thành phố Đà Nẵng","districts":{"76":"Huyện Hòa Vang","77":"Huyện Hoàng Sa","78":"Quận Cẩm Lệ","79":"Quận Hải Châu","80":"Quận Liên Chiểu","81":"Quận Ngũ Hành Sơn","82":"Quận Sơn Trà","83":"Quận Thanh Khê"}},"3":{"name":"Thành phố Hà Nội","districts":{"85":"Huyện Ba Vì","86":"Huyện Chương Mỹ","87":"Huyện Đan Phượng","88":"Huyện Đông Anh","89":"Huyện Gia Lâm","90":"Huyện Hoài Đức","91":"Huyện Mê Linh","92":"Huyện Mỹ Đức","93":"Huyện Phú Xuyên","94":"Huyện Phúc Thọ","95":"Huyện Quốc Oai","96":"Huyện Sóc Sơn","97":"Huyện Thạch Thất","98":"Huyện Thanh Oai","99":"Huyện Thanh Trì","100":"Huyện Thường Tín","101":"Huyện Từ Liêm","102":"Huyện ứng Hòa","103":"Quận Ba Đình","104":"Quận Cầu Giấy","105":"Quận Đống Đa","106":"Quận Hà Đông","107":"Quận Hai Bà Trưng","108":"Q
@cuduy197
cuduy197 / shuffle-array.js
Created September 15, 2017 19:21 — forked from rodrigograca31/shuffle-array.js
Shuffle Array in Javascript
/**
* Randomize array element order in-place.
* Using Durstenfeld shuffle algorithm.
*/
function shuffleArray(array) {
for (var i = array.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = array[i];
array[i] = array[j];
array[j] = temp;
@cuduy197
cuduy197 / bodau.js
Created September 11, 2017 18:10
Bỏ dấu tiếng việt
function bodau(str,isLowerCase, isUnderLine) {
if(isLowerCase) {str = str.toLowerCase()}
str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, 'a');
str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, 'e');
str = str.replace(/ì|í|ị|ỉ|ĩ/g, 'i');
str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g, 'o');
str = str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g, 'u');
str = str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g, 'y');
str = str.replace(/đ/g, 'd');
if(isUnderLine) {
@cuduy197
cuduy197 / unorm.js
Created August 22, 2017 23:41
normalize() polifill
!function(t){"use strict";function r(t,r,e){var n=y[r];return n||(n=t(r,e),n.feature&&++N[r>>8&255]>c&&(y[r]=n)),n}function e(t,r,e){var n=65280&r,i=F.udata[n]||{},o=i[r];return o?new F(r,o):new F(r,h)}function n(t,r,e){return e?t(r,e):new F(r,null)}function i(t,r,e){var n;if(l>r||r>=l+g&&p>r||r>p+m)return t(r,e);if(r>=l&&l+g>r){var i={},o=(r-l)*v;for(n=0;v>n;++n)i[C+n]=p+w*(n+o);return new F(r,[,,i])}var s=r-p,u=s%w,f=[];if(0!==u)f[0]=[p+s-u,d+u];else for(f[0]=[l+Math.floor(s/B),C+Math.floor(s%B/w)],f[2]={},n=1;w>n;++n)f[2][d+n]=r+n;return new F(r,f)}function o(t,r,e){return 60>r||r>13311&&42607>r?new F(r,h):t(r,e)}function s(t){return z("NFD",t)}function u(t){return z("NFKD",t)}function f(t){return z("NFC",t)}function a(t){return z("NFKC",t)}for(var h=[null,0,{}],c=10,p=44032,l=4352,C=4449,d=4519,g=19,v=21,w=28,B=v*w,m=g*B,F=function(t,r){this.codepoint=t,this.feature=r},y={},N=[],x=0;255>=x;++x)N[x]=0;var S=[o,r,n,i,e];F.fromCharCode=S.reduceRight(function(t,r){return function(e,n){return r(t,e,n)}},null),
@cuduy197
cuduy197 / index.html
Created August 18, 2017 15:44
Tính Can Chi // source https://jsbin.com/tucemav
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Tính Can Chi</title>
<style id="jsbin-css">
@import url('https://fonts.googleapis.com/css?family=Comfortaa');
body {
font-family: 'Comfortaa';
a:hover,button{background-color:#fff;color:#000}button{font-family:Comfortaa,sans-serif;border:2px solid #ecf0f1;border-radius:10px;font-size:20px;-webkit-transition:all .25s linear 0s;-o-transition:all .25s linear 0s;transition:all .25s linear 0s;-webkit-box-shadow:2px 2px 4px rgba(0,0,0,.4);box-shadow:2px 2px 4px rgba(0,0,0,.4);padding:.2em;position:relative;overflow:hidden}button:hover{border:2px solid #2c3e50;-webkit-box-shadow:4px 4px 6px #2c3e50;box-shadow:4px 4px 6px #2c3e50;cursor:pointer;-webkit-transform:translateY(-2px);-ms-transform:translateY(-2px);transform:translateY(-2px)}a{color:#2c3e50}a:hover{border-radius:5px}button:after{content:'';position:absolute;top:50%;left:50%;width:5px;height:5px;background:rgba(255,255,255,.5);opacity:0;border-radius:50%;-webkit-transform:scale(1,1) translate(-70%);-ms-transform:scale(1,1) translate(-70%);transform:scale(1,1) translate(-70%);-webkit-transform-origin:50% 50%;-ms-transform-origin:50% 50%;transform-origin:50% 50%}@-webkit-keyframes ripple{0%{-webkit-
// Style
var styleNode = document.createElement("style");
styleNode.type = "text/css";
// browser detection (based on prototype.js)
var style = "a:hover,button{background-color:#fff;color:#000}button{font-family:Comfortaa,sans-serif;border:2px solid #ecf0f1;border-radius:10px;font-size:20px;-webkit-transition:all .25s linear 0s;-o-transition:all .25s linear 0s;transition:all .25s linear 0s;-webkit-box-shadow:2px 2px 4px rgba(0,0,0,.4);box-shadow:2px 2px 4px rgba(0,0,0,.4);padding:.2em;position:relative;overflow:hidden}button:hover{border:2px solid #2c3e50;-webkit-box-shadow:4px 4px 6px #2c3e50;box-shadow:4px 4px 6px #2c3e50;cursor:pointer;-webkit-transform:translateY(-2px);-ms-transform:translateY(-2px);transform:translateY(-2px)}a{color:#2c3e50}a:hover{border-radius:5px}.danger,.guide,.info,.normal,.success,.warning{color:#fff}button:after{content:'';position:absolute;top:50%;left:50%;width:5px;height:5px;background:rgba(255,255,255,.5);opacity:0;border-radius:50%;-web
@cuduy197
cuduy197 / amlich.sh
Last active July 29, 2017 17:11
Tính âm lịch bằng bash shell
#Nam 0 Canh Than
CAN=( "Canh" "Tân" "Nhâm" "Qúy" "Giáp" "Ất" "Bính" "Đinh" "Mậu" "Kỷ" )
CAN_HANTU=( "庚" "辛" "壬" "癸" "甲" "乙" "丙" "丁" "戊" "己")
CAN_NGUHANH=( "Kim" "Kim" "Thủy" "Thủy" "Mộc" "Mộc" "Hỏa" "Hỏa" "Thổ" "Thổ" )
CAN_AMDUONG=( "Dương" "Âm" "Dương" "Âm" "Dương" "Âm" "Dương" "Âm" "Dương" "Âm" )
CHI=("Thân" "Dậu" "Tuất" "Hợi" "Tý" "Sửu" "Dần" "Mão" "Thìn" "Tỵ" "Ngọ" "Mùi" )
CHI_HANTU=( "申" "酉" "戌" "亥" "子" "丑" "寅" "卯" "辰" "巳" "午" "未" )
#color