This file contains 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 getBase64 = (img, callback) => { | |
const reader = new FileReader(); | |
reader.addEventListener("load", () => callback(reader.result)); | |
reader.readAsDataURL(img); | |
}; | |
const getFiles = event => { | |
if (event.dataTransfer) { | |
return event.dataTransfer.files; |
This file contains 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 sliderElement = document.querySelector(".main-slider"); | |
if (sliderElement) { | |
const slider = new Swiper(".swiper-container", { | |
slidesPerView: 1, | |
spaceBetween: 0, | |
watchOverflow: true, | |
loop: true, | |
autoplay: { | |
delay: 4000, |
This file contains 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
/** | |
* Image Component | |
*/ | |
/* | |
// Usage example | |
<Image | |
alt='example' | |
className='additional-className' | |
src='example-small.png', |
This file contains 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
@mixin clearfix { | |
&:after { | |
content: ''; | |
display: table; | |
clear: both; | |
} | |
} | |
@mixin visuallyhidden { | |
position: absolute; |
This file contains 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
/** | |
* Think of this "main.js" file as your application bootstrap. | |
*/ | |
import Vue from 'vue' | |
import Resource from 'vue-resource' | |
import VueRouter from 'vue-router' | |
import routes from './routes' | |
import middleware from './middleware' |
This file contains 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
<script> | |
export default { | |
name: "ButtonGroup", | |
// eslint-disable-next-line no-unused-vars | |
render(h) { | |
return ( | |
<div class="button-group"> | |
{this.$slots.default && |
This file contains 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
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
const DEFAULT_LOADER_CHARACTERS = '\\|/—'; // ⣾⣽⣻⢿⡿⣟⣯⣷ | |
const DEFAULT_LOADER_SPEED_MS = 100; | |
const LOADER_STYLE = { | |
fontFamily: 'monospace', | |
}; | |
export default class Loader extends React.Component { |
This file contains 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
// @url https://www.sitepoint.com/react-architecture-best-practices/ | |
import React, { Component } from 'react'; | |
import PropTypes from 'prop-types'; | |
import { connect } from 'react-redux'; | |
import { push } from 'react-router-redux'; | |
export default function requiresAuth(WrappedComponent) { | |
class AuthenticatedComponent extends Component { | |
static propTypes = { | |
user: PropTypes.object, |
This file contains 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
// Micromodal | |
import MicroModal from "micromodal"; | |
const youtubeCommand = func => | |
window.JSON.stringify({ event: "command", func }); | |
const execCommand = (frame, command) => { | |
if (null === frame.contentWindow) { | |
return; | |
} |
This file contains 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
/* need underscore.js */ | |
/** | |
* randomNum | |
* randomNum(3,6); => 4 | |
*/ | |
var randomNum = function(from, to) { | |
return from + Math.floor( Math.random() * (to - from + 1) ); | |
}; |