Skip to content

Instantly share code, notes, and snippets.

View srkmrs's full-sized avatar

Sreekumar Sasidharan srkmrs

View GitHub Profile
@srkmrs
srkmrs / complex_styled_maps
Created October 1, 2013 08:29
Complex styled maps
<!DOCTYPE html>
<html>
<head>
<title>Complex styled maps</title>
<link href="https://developers.google.com/maps/documentation/javascript/examples/default.css" rel="stylesheet">
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
function getLocation(){
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(initialize, error);
@srkmrs
srkmrs / use_strict
Last active December 22, 2015 03:19
Use Strict
By marking the top of the script block or function with the "use strict” directive,
the compiler will provide early warnings and errors for common coding mistakes,
and restrict the usage of some dark corners of the JavaScript language.
Let you see how the following sample code interact with Strict Mode.
Code
"use strict";
a = 100;
@srkmrs
srkmrs / retina_js_implementation
Last active December 22, 2015 00:19
Retina javascript implementation
Workaround/Solution
Modified ImgSwapper js file.
line number 18,22,42
//Default attributes
defaults: function() {
return _.extend(..), {
type: 'ImgSwapper',
@srkmrs
srkmrs / ie_compatibility_mode
Created August 29, 2013 12:51
‘You are using an outdated browser’ message hide in IE when running in compatibility mode.
<!DOCTYPE html>
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta charset="utf-8">
<title>Browser Mode - Compat View</title>
@srkmrs
srkmrs / retina_display_media_query
Created August 27, 2013 08:25
Retina Display Media Query
Retina Display Media Query
For including high-res graphics, but only for screens that can make use of them. "Retina" being "2x":
@media
(-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
/* Retina-specific stuff here */
}
Or other highish-res:
if (typeof (AC) === "undefined") {
AC = {}
}
AC.ImageReplacer = Class.create({
_defaultOptions: {
listenToSwapView: true,
filenameRegex: /(.*)(\.[a-z]{3}($|#.*|\?.*))/i,
filenameInsert: "_☃x",
ignoreCheck: /(^http:\/\/movies\.apple\.com\/|\/105\/|\/global\/elements\/quicktime\/|_(([2-9]|[1-9][0-9]+)x|nohires)(\.[a-z]{3})($|#.*|\?.*))/i,
attribute: "data-hires",
@srkmrs
srkmrs / hide_empty_row
Last active December 20, 2015 22:59
Find and hide the empty row
/**
Once the dom is rendered or ready , invoke or call the method named hideEmptyRows.
How to call
hideEmptyRows(1000);
or
hideEmptyRows();
Preferable
hideEmptyRows(10);
**/