Skip to content

Instantly share code, notes, and snippets.

View endigo9740's full-sized avatar

Chris Simmons endigo9740

View GitHub Profile
@endigo9740
endigo9740 / gist:1990550
Created March 7, 2012 02:43
Javascript: HTML5 Shiv
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
@endigo9740
endigo9740 / gist:1990562
Last active October 1, 2015 12:18
HTML: Mobile Meta Viewports
<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no' />
@endigo9740
endigo9740 / gist:1994839
Created March 7, 2012 18:16
CSS: Media Queries
<!-- Via Link Tag -->
<link rel="stylesheet" href="handheld.css" media="only screen and (max-device-width:480px)"/>
<!-- Via CSS Media Queries -->
<style type="text/css">
/* Width */
@media (max-width: 1024px) { body {width: 1024px;} } /* Landscape */
@media (max-width: 768px) { body {width: 768px;} } /* Portrait */
@endigo9740
endigo9740 / gist:1994877
Created March 7, 2012 18:18
Javascript: Mobile User Agent
<script>
var ua = navigator.userAgent;
var checker = {
ios: ua.match(/(iPhone|iPod|iPad)/),
blackberry: ua.match(/BlackBerry/),
android: ua.match(/Android/),
windowsphone: ua.match(/Windows Phone/)
};
$(document).ready(function() {
@endigo9740
endigo9740 / gist:2001699
Created March 8, 2012 16:01
CSS: IE Hacks
<style type="text/css">
body {
color: red; /* all browsers, of course */
color : green\9; /* IE8 and below */
*color : yellow; /* IE7 and below */
_color : orange; /* IE6 */
}
</style>
@endigo9740
endigo9740 / gist:2026863
Created March 13, 2012 04:57
Jquery: Add/Remove Elements
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Jquery Add/Remove Elements</title>
<style>
*{margin: 0; padding: 0;}
html {background: #CCC; font-family:Helvetica,Arial,sans-serif;}
body {width: 1024px; margin: 50px auto;}
h1 {float: left;}
@endigo9740
endigo9740 / gist:2028984
Created March 13, 2012 14:07
Javascript: Text Replacement
<div id="ios">
<a href="itms://itunes.apple.com/us/app/ktvb/id401142659?mt=8">iTunes Link Here</a>
</div>
<div id="android">
<a href="market://details?id=com.doapps.android.mln.MLN_dcef0f44a0df1e66efd449f37cf9fe01">Android Link Here1</a>
<a href="market://details?id=com.doapps.android.mln.MLN_18f5510dffbc3d27e96d0e8c148d8b76">Android Link Here2</a>
</div>
<script src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript">
@endigo9740
endigo9740 / Javascript: Fetch URL Parameters
Created May 17, 2012 15:49
Javascript: Fetch URL Parameters
// URL Parameters
function getUrlVars(){
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
@endigo9740
endigo9740 / gist:3830303
Created October 3, 2012 22:30
Javascript - Jquery URL Status Check
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.js"></script>
<script type="text/javascript">
@endigo9740
endigo9740 / PHP Dynamic Input Post Var Assignment
Created November 28, 2012 19:56
PHP: Dynamic Post Var Assignment
foreach($_POST as $key => $value) {
$$key = $value;
// $$key = addslashes(trim($value)); // Sanitized Version
}
// Source: http://www.daniweb.com/web-development/php/threads/148513/assigning-dynamic-post-variables