Skip to content

Instantly share code, notes, and snippets.

View endigo9740's full-sized avatar

Chris Simmons endigo9740

View GitHub Profile
@endigo9740
endigo9740 / .bash_profile
Created March 14, 2014 16:34
.bash_profile (by Andrew)
######################################################################
# Recolor Prompt and show current GIT Branch
######################################################################
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function reviseprompt {
local BLACK="\[\033[0;30m\]"
local BLACK_BOLD="\[\033[1;30m\]"
@endigo9740
endigo9740 / gist:5374980
Last active December 16, 2015 04:09
PHP: MySQL Query Timer
$time_start = microtime(true);
// MySQL Query Here...
$time_end = microtime(true);
$time = $time_end - $time_start;
echo "execution time: ".$time." s";
@endigo9740
endigo9740 / Text: Stations
Created February 27, 2013 21:40
Text: Stations
<!-- Station URLs -->
http://www.azfamily.com
http://www.kens5.com
http://www.kgw.com
http://www.khou.com
http://www.king5.com
http://www.kmov.com
http://www.krem.com
http://www.ktvb.com
@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
@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 / 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: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 / 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: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: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() {