Skip to content

Instantly share code, notes, and snippets.

View GoodNew5's full-sized avatar
🏠
Working from home

GoodNew5 GoodNew5

🏠
Working from home
View GitHub Profile
@GoodNew5
GoodNew5 / controller.js
Last active June 3, 2017 00:17
controller.js
function uiController(domElement){
var data = domElement.data();
domElement.toggleClass('active');
$(data.target).toggleClass('active');
$(data.remove).removeClass('active');
}
$(controller).click(function(e){
uiController($(this));
@GoodNew5
GoodNew5 / tabs.js
Last active June 3, 2017 13:42
js__tabs
function tabs(domElement){
var active = 'active';
var content = $('.tab-content__item');
$(domElement).click(function () {
var index = $(this).index();
content.eq(index).addClass(active).siblings().removeClass(active);
$(this).addClass(active).siblings().removeClass(active);
});
}
@GoodNew5
GoodNew5 / server.js
Created March 11, 2018 12:52
local server
var http = require('http');
var static = require('node-static');
var file = new static.Server('.');
http.createServer(function (req, res) {
file.serve(req, res);
}).listen(5000);
console.log('Server running on port 5000');
@GoodNew5
GoodNew5 / getScrollbarWidth.js
Created March 11, 2018 23:36
get scrollbar width
function getScrollBarWidth() {
let scrollDiv = document.createElement("div");
scrollDiv.style.overflowY = "scroll";
scrollDiv.style.width = "50px";
scrollDiv.style.height = "50px";
scrollDiv.style.visibility = "hidden";
document.body.appendChild(scrollDiv);
let scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
return scrollbarWidth
@GoodNew5
GoodNew5 / triangle.scss
Created June 14, 2018 13:35
triangle.scss
@mixin triangle($direction, $color, $height, $width) {
border-style: solid;
height: 0;
width: 0;
@if($direction == 'top') {
border-color: transparent transparent $color transparent;
border-width: 0 ($width/2) $height ($width/2);
}
@if ($direction == 'bottom') {
border-color: $color transparent transparent transparent;
@GoodNew5
GoodNew5 / aspect-ratio.scss
Last active June 18, 2018 19:10
aspect-ratio.scss
@mixin aspect-ratio($width, $height) {
position: relative;
&:before{
display: block;
content: " ";
width: 100%;
padding-top: ($height / $width) * 100%;
}
}
@GoodNew5
GoodNew5 / css-counter.scss
Created September 30, 2018 17:28
simple css-counter
@mixin css-counter($element, $start: 1) {
@if($start == 1) {
counter-reset: list;
}
@else {
$start: $start - 1;
counter-reset: list #{$start};
}
<template>
<div
class="bonuses-accordion-bar"
@click="handleStaticPageClick"
>
<div class="accordion-1">
<div
ref="accordionItem"
class="accordion-1__item accordion-1__item--no-num"
>
@GoodNew5
GoodNew5 / Modal.vue
Last active April 19, 2022 14:27
open modal
<template>
<div>
<btn @click="openCustomModal">btn</btn>
</div>
</template>
<script>
import Btn from '@/common-components/btn'
import { mapActions } from 'vuex'
/^(?=.*?[A-Za-z])(?=.*[0-9])[a-zA-Z0-9#?!@$%^&*-]{8,}$/.test(self.password.value)