Skip to content

Instantly share code, notes, and snippets.

@rolia17
rolia17 / Aspect Ratio SCSS
Last active October 13, 2015 21:18
Aspect ratio sass mixin
@mixin aspect-ratio($width, $height) {
position: relative;
&:before {
display: block;
content: "";
width: 100%;
padding-top: ($height / $width) * 100%;
}
> .content {
position: absolute;
/*
* Telephone number class
*/
.tel {
color: inherit;
cursor: default;
text-decoration: none;
&:hover {
color: inherit;
}
@rolia17
rolia17 / isMobile.js
Created August 14, 2015 10:09
Detect mobile devices
/**
* @function isMobile
* @description a jQuery function to detect mobile devices
* @param userAgents [array]
* @return object
*/
var userAgents = ['iPad', 'iPhone', 'Android', 'IEMobile', 'BlackBerry'];
function isMobile(userAgents) {
@rolia17
rolia17 / .htaccess
Created April 11, 2015 08:16
Apache 2 Basic Auth
AuthType Basic
AuthName "Restricted Files"
AuthBasicProvider file
AuthUserFile /usr/local/apache/passwd/passwords
Require user rbowen
@rolia17
rolia17 / .htaccess
Created October 21, 2014 00:35
Apache /page.html to /page rewrite rule
RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.html\ HTTP
RewriteRule ^([^.]+)\.html$ http://YOURSITE.ru/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !(\.[^./]+)$
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule (.*) /$1.html [L]
@rolia17
rolia17 / Bootstrap 100% Height Table
Last active August 29, 2015 14:07
bs3-fullHeight
.table-container {
display: table;
}
.table-container .table-row {
height: 100%;
display: table-row;
}
.table-container .table-row .table-col {
/*!
* Dynamically changing favicons with JavaScript
* Works in all A-grade browsers except Safari and Internet Explorer
* Demo: http://mathiasbynens.be/demo/dynamic-favicons
*/
// HTML5™, baby! http://mathiasbynens.be/notes/document-head
document.head || (document.head = document.getElementsByTagName('head')[0]);
function changeFavicon(src) {