Skip to content

Instantly share code, notes, and snippets.

responsive-font-mixin

@author Bachana Papunashvili

responsive font @mixin for scss

@example @include responsive-font(14, 30, 320, 1600);

//
// responsive font
@Bachana123
Bachana123 / format for date vue nuxt
Created November 28, 2019 10:45
format for date vue.nuxt
format(time, format) {
var t = new Date(time);
var tf = function (i) { return (i < 10 ? '0' : '') + i };
return format.replace(/yyyy|MM|dd|HH|mm|ss/g, function (a) {
switch (a) {
case 'yyyy':
return tf(t.getFullYear());
break;
case 'MM':
return tf(t.getMonth() + 1);
@Bachana123
Bachana123 / format date for vue nuxt
Last active November 28, 2019 11:02
format date for vue nuxt
new Date( time.toLocaleDateString('ka-GE',{ day: 'numeric', month: 'long', year: 'numeric' })
@Bachana123
Bachana123 / Fonts on different languages
Created November 29, 2019 09:54
Fonts on different languages
//
/// @group Fonts
/// @access public
/// @param {string} $lang-code
/// @param {string} $font-family
/// @param {string} $font-size
/// @example body{ @include fonts('ka','bpg-nino-mtavruli',18px) }
/// @return
/// html[lang="ka"]{ body{ font-family: 'bpg-nino-mtavruli; font-size: 18px;} }
//
@Bachana123
Bachana123 / better localePath for NUXT!
Created December 4, 2019 11:37
better localePath for NUXT!
// fixed nested link routing problem Instead localePath
import Vue from 'vue'
Vue.mixin({
methods: {
localeLink(link,lang = ''){
link = link.split("/").filter(item => item !="").join("/");
if(lang!='')
@Bachana123
Bachana123 / removeTag
Created December 5, 2019 11:16
mixin for removing any tag from passed html string
import Vue from 'vue'
Vue.mixin({
methods: {
removeTag(string, tag) {
var regex = "/<\/?(" + tag + ")\b[^<>]*>/g"
return string.replace( regex, "")
}
}
})
const ka = require('../lang/ka-GE.js')
const en = require('../lang/en-US.js')
const I18N = {
locales: [
{
code: 'ka',
iso: 'ka',
name: 'Georgian'
},
{
@Bachana123
Bachana123 / forcing scroll
Created December 6, 2019 07:40
forcing scroll
/*
** Forcing the scroll position to the top for every routes:
*/
// router: {
// scrollBehavior: function (to, from, savedPosition) {
// console.log(to);
// return { x: 0, y: 0 }
// }
// },
@Bachana123
Bachana123 / fav icon meta
Last active December 6, 2019 07:41
fav icon meta
const favicon = require('./config/favicon')
head: {
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
...favicon.meta
],
link: [
...favicon.links
]
@Bachana123
Bachana123 / nuxt route change
Created December 6, 2019 07:43
nuxt route change
- watch: {
'$route' (to, from) {
this.updateBurger(false);
}
},