Skip to content

Instantly share code, notes, and snippets.

View Woorg's full-sized avatar

Igor Gorlov Woorg

View GitHub Profile
@Woorg
Woorg / convert pixels to em
Created November 13, 2014 18:47
convert pixels to em
@mixin em($px, $base: $base__font) {
$return ($px / $base) * 1em;
}
@Woorg
Woorg / proportional height
Created December 25, 2014 23:19
proportional height by width
@mixin pad-ratio($x, $y, $selector: img) {
position: relative;
padding: 0 0 percentage($y/$x) 0;
height: 0;
#{$selector} {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
@Woorg
Woorg / gist:5ba833a949a0a89b57f8
Created December 26, 2014 12:15
markup regression test
var a,w=document.createTreeWalker(document,NodeFilter.SHOW_TEXT);while(a=w.nextNode()){if(a.textContent.trim().length)a.textContent='Одиннадцатиклассница пошла посмотреть на достопримечательность, она шла долго, несколько строчек, пока не пришла'}
/**
* Create a custom overlay for our window marker display, extending google.maps.OverlayView.
* This is somewhat complicated by needing to async load the google.maps api first - thus, we
* wrap CustomWindow into a closure, and when instantiating CustomWindow, we first execute the closure (to create
* our CustomWindow function, now properly extending the newly loaded google.maps.OverlayView), and then
* instantiate said function.
* Note that this version uses jQuery.
* @type {Function}
*/
(function(){
@Woorg
Woorg / datauri_stylus.coffee
Created August 2, 2015 18:04
Data:uri for stylus
url: { name: 'datauri', limit : false}
<div id="preloader"></div>
#preloader { position: fixed; left: 0; top: 0; z-index: 999; width: 100%; height: 100%; overflow: visible; background: #333 url('http://files.mimoymima.com/images/loading.gif') no-repeat center center; }
jQuery(document).ready(function($) {
// site preloader -- also uncomment the div in the header and the css style for #preloader
$(window).load(function(){
$('#preloader').fadeOut('slow',function(){$(this).remove();});
<?php
$args = array(
// Arguments for your query.
);
// Custom query.
$query = new WP_Query( $args );
// Check that we have query results.
anim($('#footer_logo'));
function anim(block) {
block.hover( function() { trig=1; repeat(); }, function() { trig=0; } );
var trig = 0;
function repeat() {
if (trig)
block.animate({backgroundColor: $.Color(block.css('backgroundColor')).hue('+=6')}, 30, repeat);
}
}
font-bold(fs, lh)
font normal fs / lh 'open_sansbold', sans-serif
font-regular(fs, lh)
font normal fs / lh 'open_sansregular', sans-serif
font-semibold(fs, lh)
font normal fs / lh 'open_sanssemibold', sans-serif
font-light(fs, lh)
font normal fs / lh 'open_sanslight', sans-serif
//
// TRACKING
// ========
//
tracking($val, $base = false)
if $base
( ( $val * $base ) / 1000 ) px
else