Skip to content

Instantly share code, notes, and snippets.

View ansidev's full-sized avatar
🎯
Focusing

Le Minh Tri ansidev

🎯
Focusing
View GitHub Profile
@ansidev
ansidev / Dockerfile
Last active September 28, 2019 16:37
How to change character set and collation setting MariaDB/MySQL Docker
FROM mariadb
RUN { \
echo '[mysqld]'; \
echo 'character-set-server=utf8mb4'; \
echo 'collation-server=utf8mb4_unicode_ci'; \
} > /etc/mysql/conf.d/charset.cnf
@ansidev
ansidev / OAuth2AccessTokenNestedJsonResponseHttpMessageConverter.java
Created September 13, 2019 10:33
OAuth2 Access Token Nested Json Response Http Message Converter
/*
* Copyright 2002-2018 the original author or authors.
*
* 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
@ansidev
ansidev / author.png
Last active June 3, 2019 20:32
author
author.png
@ansidev
ansidev / developer.png
Last active June 3, 2019 20:33
developer
developer.png
@ansidev
ansidev / christian.png
Last active June 3, 2019 20:18
christian
christian.png
@ansidev
ansidev / store.js
Created May 27, 2019 10:51
Vuex Store
export const actions = {
foo: async ({ commit }, data) => {
commit('foo', data)
},
bar: async ({}, data) => {
return data
}
}
@ansidev
ansidev / hyper.js
Created May 27, 2019 10:09
Hyper config
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// hyperline: {
// plugins: [
// "time",
// "uptime",
const date = new Date(2019, 0, 1);
const day = date.getDate().toString();
console.log(day.padStart(2, '0'));
@ansidev
ansidev / random_date.js
Created April 22, 2019 09:20
Random a date in Javascript
function randomDate(startDate, endDate) {
return new Date(
startDate.getTime() +
Math.random() * (endDate.getTime() - startDate.getTime())
);
}
// Random a date in 2019
console.log(randomDate(new Date(2019, 0, 1), new Date(2019, 11, 31)));
@ansidev
ansidev / resize-event.vue
Created February 1, 2019 07:29
Handle resize event in Nuxt JS
<script>
export default {
mounted: function () {
this.$nextTick(function () {
this.onResize();
})
window.addEventListener('resize', this.onResize)
},
methods: {
onResize() {