Skip to content

Instantly share code, notes, and snippets.

@ideefixe
ideefixe / grayscale.html
Created January 30, 2013 18:31
Javascript Grayscale
<ul class="imglist">
<li><a href="#"><img src="/path/to/your/image.jpg"></a></li>
<li><a href="#"><img src="/path/to/your/image.jpg"></a></li>
<li><a href="#"><img src="/path/to/your/image.jpg"></a></li>
</ul>
@ideefixe
ideefixe / browser_detect.js
Created January 30, 2013 18:11
Detect Browsers, Versions, Mobile, Desktop, and OS with Javascript
var BrowserDetect = {
init: function() {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function(data) {
for (var i = 0; i < data.length; i++) {
var dataString = data[i].string;
var dataProp = data[i].prop;
@ideefixe
ideefixe / Susy_sub_pixel_rendering_fix.js
Created January 29, 2013 23:52
Susy Sub Pixel Rendering Fix for Safari
if (jQuery.browser.safari) {
var width = $(window)
.width();
if (width < 671) {
$('.people_image')
.css('width', '32.5%');
} else if (width >= 1000) {
$('.people_image')
.css('width', '15.3%');
} else if (width > 671 && width <= 999) {
@ideefixe
ideefixe / center.css
Created January 28, 2013 20:59
Center Div Vertically and Horizontally
.center {
width: 300px;
height: 300px;
position: absolute;
left: 50%;
top: 50%;
margin-left: -150px;
margin-top: -150px;
}
@ideefixe
ideefixe / filp-image.css
Created January 28, 2013 20:54
Flip Image CSS
img {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
@ideefixe
ideefixe / safari_version_targeting.js
Last active December 11, 2015 20:39
Safari Version Targeting
function isSafari() {
if (BrowserDetect.browser === 'Safari' && BrowserDetect.version < 6){ //detects safari versions less than 6
// JS goes here
if(window.devicePixelRatio){
}
@ideefixe
ideefixe / form_validation.js
Created January 25, 2013 20:50
Javascript Form Validation
function init() {
$('#general').on('submit', function(e) {
pass = true;
$('input, textarea', this).removeClass('error');
$('input, textarea', this).each(function() {
if ($(this).val() === '') {
$(this).addClass('error');
pass = false;
}
@ideefixe
ideefixe / responsive_image_fix_ie8.css
Created January 25, 2013 19:16
Fix Responsive images in ie8
@media \0screen {img { width: auto }}
@ideefixe
ideefixe / sitemap.php
Created January 23, 2013 18:39
WordPress Sitemap Template
<?php
/**
* Template Name: Sitemap
*/
?>
<h2 id="authors">Authors</h2>
<ul>
<?php
wp_list_authors(
@ideefixe
ideefixe / ipad_media_queries.css
Created January 22, 2013 21:27
iPad Media Queries
/* iPads 1 & 2 (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
/* css goes here */
}
/* iPads 1 & 2 (landscape) ----------- */
@media only screen
and (min-device-width : 768px)