Skip to content

Instantly share code, notes, and snippets.

View adi518's full-sized avatar
🌴
On vacation

Adi adi518

🌴
On vacation
View GitHub Profile
function generateClassName (amountOfLettersInClassName) {
amountOfLettersInClassName = amountOfLettersInClassName || 9;
var className = [];
for (var i = 0; i < amountOfLettersInClassName; i++) {
var charCodeOffset = 65;
var numeral = Math.round(Math.random() * 25) + charCodeOffset;
var letter = String.fromCharCode(numeral);
className.push(letter);
}
<template>
<v-button v-on="$listeners">
<slot/>
</v-button>
</template>
<script>
// Abstract
import Button from './Button.bare'
<template>
<div :class="[namespace]">
</div>
</template>
<script>
// Abstract
import Component from '@/components/component'
// Components
<template>
<div :class="[namespace.kebab]" v-if="show">
<div class="overlay"></div>
<div class="window">
<button class="close" @click="close" v-if="withClose" />
<slot v-bind="api" />
</div>
</div>
</template>
<template>
<div :class="[namespace.kebab]">
<h2 class="title" v-if="$slots.title">
<slot name="title" />
</h2>
<div class="body">
<slot name="body" />
</div>
<slot name="button">
<w-modal-button @click="$props.close">אישור</w-modal-button>
<template>
<w-modal :show.sync="show">
<template scope="api">
<w-modal-content v-bind="api">
<template slot="title">
{{shortLorem}}
</template>
<template slot="body">
{{lorem}}
</template>
// https://stackoverflow.com/questions/23757345/android-does-not-correctly-scroll-on-input-focus-if-not-body-element
export const androidScrollOnInputFocusPolyfill = () => {
if (document.activeElement.tagName === 'INPUT') {
window.setTimeout(function () {
document.activeElement.scrollIntoViewIfNeeded()
}, 0)
}
}
export default {
install(Vue, options) {
Vue.prototype.$state = options.store.state
Vue.prototype.$getters = options.store.getters
Vue.prototype.$commit = options.store.commit
Vue.prototype.$dispatch = options.store.dispatch
}
}
export default {
install(Vue, options) {
Vue.prototype.$bus = options.EventBus
}
}
isValidIsraeliId: value => {
let extrapolationA = 0
const extrapolationB = parseInt(value.charAt(8), 10)
for (let i = 0; i < 8; i++) {
let extrapolatedDigit = (i % 2 + 1) * value.charAt(i)
if (extrapolatedDigit > 9) {
const extrapolatedDigitString = extrapolatedDigit.toString()
extrapolatedDigit = parseInt(extrapolatedDigitString.charAt(0), 10)
extrapolatedDigit += parseInt(extrapolatedDigitString.charAt(1), 10)
}