Skip to content

Instantly share code, notes, and snippets.

View kislovskij's full-sized avatar

Viktor Kislovskij kislovskij

  • Leo Burnett Worldwide
  • Frankfurt am Main
View GitHub Profile
@kislovskij
kislovskij / media-queries.css
Created June 18, 2013 13:16
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 */
}
@kislovskij
kislovskij / [MacOS] Screensaver Installer
Created November 21, 2013 13:10
Installs screensaver depending on screen aspect ratio
#!/bin/sh
cd "$(dirname "$0")"
clear
echo "Installing screensaver ..."
NORMAL_ARCHIVE=files/Mac_Screensaver_QXGA.zip
WIDESCREEN_ARCHIVE=files/Mac_Screensaver_FHD.zip
SCREENSAVER_FILENAME="MyScreensaver.saver"
@kislovskij
kislovskij / high-res-timer-shim.js
Created June 18, 2013 15:23
High resolution timer shim
var now = (function() {
// Returns the number of milliseconds elapsed since either the browser navigationStart event or
// the UNIX epoch, depending on availability.
// Where the browser supports 'performance' we use that as it is more accurate (microsoeconds
// will be returned in the fractional part) and more reliable as it does not rely on the system time.
// Where 'performance' is not available, we will fall back to Date().getTime().
var performance = window.performance || {};
@kislovskij
kislovskij / datenow.js
Created June 18, 2013 13:34
Date.now shim
if (!Date.now) {
Date.now = function now() {
return new Date().getTime();
};
}
@kislovskij
kislovskij / geolocation.js
Created June 18, 2013 13:31
Geo Location shim
// geo-location shim
// currentely only serves lat/long
// depends on jQuery
// doublecheck the ClientLocation results because it may returning null results
;(function(geolocation){
if (geolocation) return;
@kislovskij
kislovskij / requestAnimationFrame.js
Created June 18, 2013 13:31
Request Animation Frame Polyfill
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
|| window[vendors[x]+'CancelRequestAnimationFrame'];
}
if (!window.requestAnimationFrame)
@kislovskij
kislovskij / blockquote.css
Created June 18, 2013 13:15
Blockquote Template
blockquote {
background: #f9f9f9;
border-left: 10px solid #ccc;
margin: 1.5em 10px;
padding: .5em 10px;
quotes: "\201C""\201D""\2018""\2019";
}
blockquote:before {
color: #ccc;
content: open-quote;
@kislovskij
kislovskij / clearfix.css
Created June 18, 2013 13:14
CSS Clearfix
.clearfix:before, .container:after { content: ""; display: table; }
.clearfix:after { clear: both; }
/* IE 6/7 */
.clearfix { zoom: 1; }
@kislovskij
kislovskij / opacity.css
Created June 18, 2013 13:25
Opacity Hack
selector {
filter: alpha(opacity=60); /* MSIE/PC */
-moz-opacity: 0.6; /* Mozilla 1.6 and older */
opacity: 0.6;
}
@kislovskij
kislovskij / transparent-png.css
Created June 18, 2013 13:19
Transparent PNG Fix for IE6
.bg {
width:200px;
height:100px;
background: url(/folder/yourimage.png) no-repeat;
_background:none;
_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/folder/yourimage.png',sizingMethod='crop');
}
/* 1px gif method */