Skip to content

Instantly share code, notes, and snippets.

@aalexeev239
aalexeev239 / meta.hbs
Last active September 18, 2018 11:53
OG markup
{{#if keywords}}
<meta name="keywords" content="{{keywords}}">
{{/if}}
{{#if description}}
<meta name="description" content="{{description}}">
{{/if}}
{{#if fb_app_id}}
<meta name="fb:app_id" content="{{fb_app_id}}">
{{/if}}
{{#each og}}
@aalexeev239
aalexeev239 / script.js
Created December 9, 2015 13:18
Generate table of contents for css
(function() {
var generate = function(sChapters, sPrefix, nFrom) {
var output1 = '', output2 = '';
var prefix = sPrefix || '';
var from = parseInt(nFrom) || 1;
var temp;
for (var i = 0; i < sChapters.length; i++) {
temp = prefix + (nFrom + i) + '. ' + sChapters[i];
output1 += temp + '\n';
output2 += '/\u002A---------- ' + temp + ' ----------\u002A/' + '\n';
@aalexeev239
aalexeev239 / style.styl
Last active May 4, 2016 16:14
toggle-btn
.toggle-btn
$time = .2s
$sz_item = 4px
$ofs = 10px
$gut_ver = 4px
// $sz_hor = 26px
$sz_hor = 50px
$sz_ver = $sz_item * 3 + 2 * $ofs + 2 * $gut_ver
$color = #f00
@aalexeev239
aalexeev239 / aa-zoomify.jsx
Created December 5, 2015 20:01
aa-zoomify
// copied from https://gist.github.com/davidmerrique/4066808
var inFolder = Folder.selectDialog("Please select folder to process");
var defaults = {
type: "w",
quality: 50,
sizes: [1680, 1000, 640]
};
@aalexeev239
aalexeev239 / style.css
Created December 3, 2015 12:04
zero centering
.zero-centered {
/* get sure that width and height declared */
/* this is useful for images */
max-width: 100%;
max-height: 100%;
width: auto;
height: auto;
/* main part */
// @2x Images (Pixel Ratio of 1.25+)
$retina2x = "only screen and (-o-min-device-pixel-ratio: 5/4), only screen and (-webkit-min-device-pixel-ratio: 1.25), only screen and (min-device-pixel-ratio: 1.25), only screen and (min-resolution: 1.25dppx)"
// @3x Images (Pixel Ratio of 2.25+)
$retina3x = "only screen and (-o-min-device-pixel-ratio: 9/4), only screen and (-webkit-min-device-pixel-ratio: 2.25), only screen and (min-device-pixel-ratio: 2.25), only screen and (min-resolution: 2.25dppx)"
@aalexeev239
aalexeev239 / media.styl
Last active February 10, 2024 07:12
stylus media breakpoints and visibility classes
$breakpoint = {
tablet : 640px,
laptop : 1000px,
desk : 1260px,
large : 1600px
}
$media = {
mobile : "(max-width: "+unit(($breakpoint.tablet - 1), 'px')+")",
tablet : "(min-width: "+unit($breakpoint.tablet, 'px')+") and (max-width: "+unit(($breakpoint.laptop - 1), 'px')+")",
@aalexeev239
aalexeev239 / rusPluralize.js
Created August 30, 2015 17:47
Pluralize russian nouns
/**
* http://habrahabr.ru/post/105428/
* Функция возвращает окончание для множественного числа слова на основании числа и массива окончаний
* @param iNumber Integer Число на основе которого нужно сформировать окончание
* @param aEndings Array Массив слов или окончаний для чисел (1, 4, 5),
* например ['яблоко', 'яблока', 'яблок']
* @return String
*/
function getNumEnding(iNumber, aEndings)
{
@aalexeev239
aalexeev239 / preventImageLoading.html
Last active September 17, 2015 23:10
prevent image loading for mobile
<!--The idea is to load base64-encoded 1px transparent gif for some media queries-->
<picture>
<source media="(max-width: 759px)" srcset="data:image/gifbase64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==">
<img src="image.png" srcset="[email protected] 2x, [email protected] 3x" height="100" width="100" alt="image">
</picture>
<picture>
<source srcset="{{img}}" media="(min-width: 768px)" />
<img srcset="data:image/gifbase64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="{{title}}" width="110" height="110" />
</picture>
@aalexeev239
aalexeev239 / markup.html
Created August 6, 2015 23:07
---- hipsta header ----
<h1>Heading</h1>
<h1>This is a longer heading</h1>