Skip to content

Instantly share code, notes, and snippets.

@gartes
gartes / phpstorm-node_sass-config.txt
Created December 3, 2022 10:50 — forked from mediaformat/phpstorm-node_sass-config.txt
node-sass with sourcemap in phpstorm
Getting node-sass to output a sourcemap took a bit of trial & error
Mostly because phpstorm does not allow for the same colon syntax that most sources reference,
specifically the Output paths to reference only took 1 argument
---
Add File Watcher SCSS in settings
Watcher Settings
Program :
C:\Users\%username%\AppData\Roaming\npm\node-sass.cmd
Arguments :
--no-cache --update --source-map=$FileNameWithoutExtension$.css.map $FileName$ $FileNameWithoutExtension$.css
@gartes
gartes / parallax.js
Created February 7, 2022 10:28 — forked from Dexdot/parallax.js
animations on scroll
const math = {
map: (x, a, b, c, d) => ((x - a) * (d - c)) / (b - a) + c,
lerp: (a, b, n) => (1 - n) * a + n * b
};
const { body } = document;
// Window
let winsize;
const calcWinsize = () => {
winsize = { width: window.innerWidth, height: window.innerHeight };
@gartes
gartes / jq.viewport.js
Created February 7, 2022 10:26 — forked from Dexdot/jq.viewport.js
jQuery viewport checker
$.fn.isInViewport = function() {
const elementTop = $(this).offset().top;
const elementBottom = elementTop + $(this).outerHeight();
const viewportTop = $(window).scrollTop();
const viewportBottom = viewportTop + $(window).height();
return elementBottom > viewportTop && elementTop < viewportBottom;
};
@gartes
gartes / htaccess.expires.headers
Created January 3, 2022 08:10 — forked from solancer/htaccess.expires.headers
htaccess expires headers
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
# CSS
ExpiresByType text/css "access plus 1 year"
# Data interchange
ExpiresByType application/atom+xml "access plus 1 hour"
@gartes
gartes / _WebStorm Babel file-watcher setup basics.md
Last active November 26, 2021 09:56
WebStorm/PHPStorm (and so on...) Babel file-watcher setup basics

Basic Babel file-watcher setup

ZXCV

This requires NPM to be installed.

Adding file-watchers

package.json file

@gartes
gartes / my-counter.js
Created October 17, 2021 19:22
Web Component Example
const template = document.createElement('template');
template.innerHTML = `
<style>
* {
font-size: 200%;
}
span {
width: 4rem;
display: inline-block;
@gartes
gartes / breakpoints.css
Created August 4, 2021 10:27 — forked from fmtarif/breakpoints.css
#css breakpoints
/* css-tricks.com/snippets/css/media-queries-for-standard-devices/ */
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
/*jslint continue:true*/
/**
* Adapted from {@link http://www.bulgaria-web-developers.com/projects/javascript/serialize/}
* Changes:
* Ensures proper URL encoding of name as well as value
* Preserves element order
* XHTML and JSLint-friendly
* Disallows disabled form elements and reset buttons as per HTML4 [successful controls]{@link http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2}
* (as used in jQuery). Note: This does not serialize <object>
* elements (even those without a declare attribute) or
@gartes
gartes / jivosite.html
Created April 14, 2021 15:30 — forked from Inontran/jivosite.html
код живосайта с lazyload
<script type='text/javascript'>
(function(){ document.jivositeloaded=0;var widget_id = 's8C7P8lJSp';var d=document;var w=window;function l(){var s = d.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = '//code.jivosite.com/script/widget/'+widget_id; var ss = document.getElementsByTagName('script')[0]; ss.parentNode.insertBefore(s, ss);}//эта строка обычная для кода JivoSite
function zy(){
//удаляем EventListeners
if(w.detachEvent){//поддержка IE8
w.detachEvent('onscroll',zy);
w.detachEvent('onmousemove',zy);
w.detachEvent('ontouchmove',zy);
w.detachEvent('onresize',zy);
}else {
@gartes
gartes / namecase.php
Created December 3, 2020 20:12 — forked from ivanscm/namecase.php
Модуль склонения личных имен существительных по падежам.
<?php
###################################################
# Модуль склонения личных имен существительных по падежам
# Кодинг Иван Григорьев aka IvanSCM
# Склонения по падежам подготовил Лапин Алексей aka NuBiK