Skip to content

Instantly share code, notes, and snippets.

View webag's full-sized avatar

Андрей webag

  • Pen&Brain
  • Kazan, Russian Federation
View GitHub Profile
@webag
webag / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@webag
webag / main.js
Created June 16, 2017 08:48
youtube api video list
/***********************
YouTube api feed BEGIN
***********************/
$(document).ready(function () {
var channelId = "UCrhuhV3v32U8DbI25GUsdIA";
var apiKey = "AIzaSyCE-obn38anepy2x4JmF-wOdCseiE234Zo";
$.ajax({
type: "GET",
url: "https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=" + channelId + "&maxResults=10&order=date&type=video&key=" + apiKey,
@webag
webag / catalog-categories.php
Created June 16, 2017 09:15
youtube api video list php
<?
$channel_id = "UCrhuhV3v32U8DbI25GUsdIA";
$api_key = "AIzaSyCE-obn38anepy2x4JmF-wOdCseiE234Zo";
$video_list_query = file_get_contents("https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=". $channel_id. "&maxResults=10&order=date&type=video&key=". $api_key);
$video_list = json_decode($video_list_query);
?>
<?
foreach ($video_list->items as $video) :
@webag
webag / template.php
Created July 27, 2017 08:13
Php вырезание значения src из строки
<?
$full_link = strval($arItem["PROPERTIES"]["LINK_TO_MAP"]["~VALUE"]);
preg_match('~src="(.*?)"~', $full_link, $matches);
?>
<a href="<?=$matches[1]?>" class="shop__map fancy-map">Схема проезда</a>
@webag
webag / main.js
Created November 15, 2018 07:18
waypoint stagger
/***********************
Waypoints BEGIN
***********************/
$(function () {
var itemQueue = [];
var delay = 150;
var queueTimer;
function processItemQueue() {
if (queueTimer) return;
@webag
webag / index.html
Created December 25, 2018 08:05
Round circle countdown to date timer counter
<div class="circle days"></div>
<div class="circle hours"></div>
<div class="circle minutes"></div>
<div class="circle seconds"></div>
@webag
webag / index.html
Created March 15, 2019 07:35
100vh height 100%
<script>
function setIntroHeight(){
var vh = window.innerHeight * 0.01;
document.documentElement.style.setProperty('--vh', vh + 'px');
}
setIntroHeight();
</script>
<style>
.block{
@webag
webag / template.php
Created March 15, 2019 10:52
bitrix watermark
<? $watermark = Array(
array("name" => "watermark", "position" => "bottomright", "size"=>"real", "file"=>$_SERVER['DOCUMENT_ROOT'].SITE_TEMPLATE_PATH."/img/watermark.png"),
array("name" => "watermark", "position" => "center", "size"=>"real", "file"=>$_SERVER['DOCUMENT_ROOT'].SITE_TEMPLATE_PATH."/img/watermark_text.png")
);?>
<?$photo_resized = CFile::ResizeImageGet($photo, array('width'=>960, 'height'=>640), BX_RESIZE_IMAGE_EXACT, false,$watermark);?>
@webag
webag / index.html
Created March 22, 2019 08:27
Video html5 js inset
<video loop muted autoplay id="head_video">
<source src="" type="video/webm" id="source_webm">
<source src="" type="video/mp4" id="source_mp4">
</video>
<script>
var aboutHeaderCheck = function() {
var aboutHeader = document.querySelector('.s-about-head');
var video = document.getElementById("head_video");
var video_mp4 = document.getElementById("source_mp4");
@webag
webag / main.js
Created April 9, 2019 12:01
Позиция элемента на странице js. Elem position
function getCoords(elem) {
const box = elem.getBoundingClientRect();
return {
top: box.top + pageYOffset,
left: box.left + pageXOffset
};
}