Skip to content

Instantly share code, notes, and snippets.

View hsleonis's full-sized avatar
🏝️
Travellers unite.

Hasan Shahriar hsleonis

🏝️
Travellers unite.
View GitHub Profile
@hsleonis
hsleonis / jquery-ie.html
Created March 31, 2016 04:08
JQuery best practice for IE
<!--
f your web site needs oldIE support, and we expect most sites will need it for at least another year or two,
you can use IE conditional comments to include version 1.9 only when visitors are using oldIE:
Reference: https://blog.jquery.com/2012/06/28/jquery-core-version-1-9-and-beyond
-->
<!--[if (!IE)|(gt IE 8)]><!-->
<script src="js/jquery-2.1.3.min.js"></script>
<!--<![endif]-->
@hsleonis
hsleonis / ie-8-support.html
Created March 31, 2016 04:30
IE < 9 Support, HTML5 for you know what and respond js is a fast & lightweight polyfill for min/max-width CSS3 Media Queries (for IE 6-8, and more)
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
@hsleonis
hsleonis / http-equiv-attribute.html
Last active March 31, 2016 05:35
Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header.
* This example causes the browser to reload the document every two seconds.
<meta http-equiv="refresh" content="2">
* This example sets the character set for the document.
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
* This example disables theme support for the document.
@hsleonis
hsleonis / tel-geo-url.html
Last active April 22, 2026 10:02
Telephone and geo location map link in html
Telephone link:
(Reference: http://code.tutsplus.com/tutorials/mobile-web-quick-tip-phone-number-links--mobile-7667)
Android and iOS automatically detect phone numbers with specific format.
(555) 555-5555 (Android + iPhone)
555 555 5555 (Android + iPhone)
555.555.5555 (Android + iPhone)
<!-- Embedded within normal page text -->
<p>If you'd like to talk, <a href="tel:5555555">Call Me!</a></p>
@hsleonis
hsleonis / select-without-expand.scss
Created March 31, 2016 10:49 — forked from delphinpro/select-without-expand.scss
Remove expand arrow in select-element
select {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
&::-ms-expand { display: none; }
}
@hsleonis
hsleonis / array_remove.js
Created March 31, 2016 11:26 — forked from HiveSolution/array_remove.js
Simple prototype ext. for array to remove elements
Array.prototype.remove = function(from, to) {
var rest = this.slice((to || from) + 1 || this.length);
this.length = from < 0 ? this.length + from : from;
return this.push.apply(this, rest);
};
@hsleonis
hsleonis / animated-window-title.js
Last active March 31, 2016 14:19
Animated window title
var strTitle = document.title,
iIndex = 0;
function animateTitle(){
document.title= strTitle.substring(iIndex, iIndex + 145);
if(iIndex == strTitle.length-1){ iIndex = 0;}
else iIndex++;
setTimeout("animateTitle()",200);
}
animateTitle();
@hsleonis
hsleonis / popup-window.js
Last active March 31, 2016 15:08
Create popup window with native js
/**
* Syntax: window.open(URL,name,specs,replace)
* Reference: http://www.w3schools.com/jsref/met_win_open.asp
*/
var URL = 'http://w3schools.com';
window.open( URL, "wo_map_console","height=650,width=800,toolbar=no,statusbar=no,scrollbars=yes").focus();
@hsleonis
hsleonis / jquery-toggle-and-div-wrap.js
Created April 2, 2016 10:13
Toogle css class without conditions
/**
* Toggle two classes
*/
$("#toggler").toggleClass("lightOn lightOff");
/**
* Wrap an HTML structure around each element in the set of matched elements
* Reference: http://api.jquery.com/wrap
*/
$( ".inner" ).wrap( "<div class='new'></div>" );
@hsleonis
hsleonis / replace-external-url-path.php
Created April 2, 2016 11:09
Replace external url with different website URL
<?php
$homepage = file_get_contents('http://www.w3schools.com/games/game_canvas.asp');
$str=str_replace("href=\"", "href=\"http://mysite.com", $homepage );
echo $str;