This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.stripViet = function () { | |
var viet = [ | |
{char: 'a', regex: 'á|à|ả|ã|ạ|ă|ắ|ằ|ẳ|ẵ|ặ|â|ấ|ầ|ẩ|ẫ|ậ'}, | |
{char: 'o', regex: 'ó|ò|ỏ|õ|ọ|ơ|ớ|ờ|ở|ỡ|ợ|ô|ố|ồ|ổ|ỗ|ộ'}, | |
{char: 'e', regex: 'é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ'}, | |
{char: 'u', regex: 'ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự'}, | |
{char: 'i', regex: 'í|ì|ỉ|ĩ|ị'}, | |
{char: 'y', regex: 'ý|ỳ|ỷ|ỹ|ỵ'}, | |
{char: 'd', regex: 'đ|ð'} | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dateTimeFormat = { | |
format: function (seconds) { | |
var now = new Date(); | |
var secFromNow = Math.floor(now.getTime() / 1000) - seconds; | |
var date = new Date(seconds * 1000); | |
var hour = date.getHours(); | |
var minute = date.getMinutes(); | |
if (secFromNow < 60) { // Dưới một phút |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create Base64 Object | |
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var BarcodeInput = React.createClass({ | |
propTypes: { | |
onInput: React.PropTypes.func.isRequired, | |
placeholder: React.PropTypes.string | |
}, | |
handleKeyUp: function(event) { | |
if (event.keyCode === 13 || event.which === 13) { | |
this.props.onInput(event.target.value); | |
event.target.select(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Return true for a valid IMEI number. | |
* | |
* @param string str - String to check | |
*/ | |
function checkLuhn(str, chk) { | |
var tmp = str.split(''); | |
var sum = 0; | |
chk = parseInt(chk || tmp.pop()); | |
tmp.forEach(function (num, idx) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validation.add('validate-date-range', '', function (value, elem) { | |
var match = elem.id.match(/^(.+)-(from|to)-(date|time)$/); | |
if (match) { | |
var fromDate = jQuery('#' + match[1] + '-from-date'); | |
if (match[3] === 'date') { | |
if (fromDate.val() > value) { | |
this.error = 'Giá trị cần phải lớn hơn hoặc bằng ' + fromDate.val(); | |
return false; | |
} | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Basic Example with JSX</title> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.css" /> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/components/input.css"/> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/components/table.css"/> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var reportn = [{},{},{},{},{},{},{}]; | |
var gamesCount = 1; | |
function resultNumber(jResultNumber) { | |
var sorted = jResultNumber.find('li:not(.arrow-result)').toArray().map(function (el) { | |
return el.innerHTML.toString(); | |
}).sort(); | |
[1,2,3,4,5,6].forEach(l => [0,1,2,3,4,5].forEach(i => { | |
if (l > i) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { | |
GraphQLObjectType, | |
} = require('graphql'); | |
const { | |
fromGlobalId, | |
nodeDefinitions, | |
} = require('graphql-relay'); | |
const modelsRegistry = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { | |
GraphQLObjectType, | |
} = require('graphql'); | |
const { | |
fromGlobalId, | |
nodeDefinitions, | |
} = require('graphql-relay'); | |
const modelsRegistry = {}; |
OlderNewer