Skip to content

Instantly share code, notes, and snippets.

View vitkon's full-sized avatar
🎨
Building accessible UIs

Vitaly Kondratiev vitkon

🎨
Building accessible UIs
View GitHub Profile
@vitkon
vitkon / gist:5672858
Created May 29, 2013 19:01
CSS: Display URLs In A Printed Webpage
@media print {
a:after {
content: " [" attr(href) "] ";
}
}
@vitkon
vitkon / gist:5672920
Created May 29, 2013 19:10
CSS: Clearfix
.clearfix:before, .container:after { content: ""; display: table; }
.clearfix:after { clear: both; }
/* IE 6/7 */
.clearfix { zoom: 1; }
@vitkon
vitkon / gist:5672988
Created May 29, 2013 19:17
CSS: General media queries
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px) and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen and (min-width : 321px) {
/* Styles */
}
@vitkon
vitkon / gist:5673058
Created May 29, 2013 19:26
JS: Test email validity
function checkMail (email) {
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(email)) {
return true;
}
return false;
}
@vitkon
vitkon / gist:5673129
Last active December 17, 2015 21:10
JS: Safe console.log (cross-browser)
// make it safe to use console.log always
(function(a){function b(){}for(var c="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),d;!!(d=c.pop());){a[d]=a[d]||b;}})
(function(){try{console.log();return window.console;}catch(a){return (window.console={});}}());
@vitkon
vitkon / gist:5673222
Last active December 17, 2015 21:10
JS: Resize iFrame to its content
$("#modalIFrame").bind('load',
function () {
var newheight,
newwidth;
newheight = this.contentWindow.document.body.scrollHeight;
newwidth = this.contentWindow.document.body.scrollWidth;
$(this).height(newheight);
$(this).width(newwidth);
@vitkon
vitkon / gist:5673266
Last active December 17, 2015 21:18
JS: Simple event logger (for debugging)
function initLogger () {
for(var eventName in $.event.global) {
$("*").bind(eventName, function(event) {
console.log(
event.type+": "+
event.target.nodeName+") "+
Array.prototype.slice.call(arguments, 1).join(", "));
});
}
}
@vitkon
vitkon / gist:5684304
Last active December 17, 2015 22:48
SASS: mixin – clearfix
@mixin clearfix() {
& {
*zoom: 1;
}
&:before,
&:after {
content: "";
display: table;
}
&:after {
@vitkon
vitkon / gist:5684315
Created May 31, 2013 11:11
SASS: mixin – center block
@mixin center-block {
display: block;
margin-left: auto;
margin-right: auto;
}
@vitkon
vitkon / .jshintrc
Created August 7, 2013 23:29 — forked from haschek/.jshintrc
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
// * set all enforcing options to true