Skip to content

Instantly share code, notes, and snippets.

View WebCulT's full-sized avatar

Alex WebCulT

View GitHub Profile
@WebCulT
WebCulT / wordpress loop
Created June 5, 2019 15:04
Wordpress loop
<?php if( have_posts() ) : while( have_posts() ) : the_post(); ?>
<?php endwhile; ?>
<?php else: ?>
<?php endif; ?>
@WebCulT
WebCulT / Tag video
Created May 26, 2019 08:19
Example of video tag
<button class="button video__play">Play</button>
<video width="305" height="170" poster="img/bg-video.jpg">
<source src="#" type='video/ogg; codecs="theora, vorbis"'>
<source src="#" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
<source src="img/9-7_RU-208934200_01.webm" type='video/webm; codecs="vp8, vorbis"'>
</video>
var startVideo = function() {
@WebCulT
WebCulT / Timer
Created May 25, 2019 11:17
Timer to something
function countdown(dateEnd) {
var timer, days, hours, minutes, seconds;
dateEnd = new Date(dateEnd[0], dateEnd[1] - 1, dateEnd[2], dateEnd[3], dateEnd[4], dateEnd[5]);
dateEnd = dateEnd.getTime();
if ( isNaN(dateEnd) ) {
return;
}
if (!Element.prototype.closest) {
// реализуем
Element.prototype.closest = function(css) {
var node = this;
while (node) {
if (node.matches(css)) return node;
else node = node.parentElement;
}
@WebCulT
WebCulT / Template scroll window to element
Last active May 4, 2019 09:21
When scroll comes to element something happening
/*TEMPLATE CODE FOR SCROLL WINDOW TILL CONCRETE ELEMENT*/
function scrollElement(event, arr, funcBottom, funcTop) {
for(var i = 0; i < arr[0].length; i++) { //Zero elememt of array is the main collaction of our func.
var cordsSkill = arr[0][i].getBoundingClientRect().top,
num = parseFloat(arr[0][i].textContent),
cordsScroll = window.pageYOffset + document.documentElement.clientHeight;
if(cordsScroll >= cordsSkill + window.pageYOffset) {
funcBottom(i, num);
}
@WebCulT
WebCulT / gist:566fc1d07c596ad96415daa900d8e353
Last active November 13, 2018 13:47 — forked from agragregra/gist:7ae9c76e895b3bacd944
Sublime Text My Settings
https://packagecontrol.io/installation#st3
Keymap (Windows Users):
[
{ "keys": ["alt+shift+f"], "command": "reindent" },
]
Settings:
{
"show_definitions": false,
@WebCulT
WebCulT / calculator 1.0.0
Created March 3, 2017 06:41
The simple calculator
'use strict';
var Calculator = function() {
var obj = this, a, b, c;
var allValue = {
'+': function() {
return a + b;
},
'-': function() {
// Код для анимации.
var doc = document;
var myName = doc.querySelector('#name');
var kek = 0;
//ШРИФТ
(function() {
var style = doc.createElement('style');
var impor = "@import 'https://fonts.googleapis.com/css?family=Lobster'";
style.innerHTML = impor;