Skip to content

Instantly share code, notes, and snippets.

View innbitcodes's full-sized avatar

InnBit Codes innbitcodes

View GitHub Profile
@innbitcodes
innbitcodes / JavaScript-Detect-IE
Created October 13, 2012 11:06 — forked from padolsey/gist:527683
JavaScript: Detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@innbitcodes
innbitcodes / source.html
Created October 31, 2012 06:07
HTML: Get HTML5 Shim
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
@innbitcodes
innbitcodes / maximage-generic.js
Created November 3, 2012 06:40 — forked from akv2/maximage-generic.js
jQuery: Generic settings for maximage demo.
$(function(){
$('#maximage').maximage({
cycleOptions: {
fx: 'fade',
// Speed has to match the speed for CSS transitions
speed: 1000,
timeout: 0,
prev: '#arrow_left',
next: '#arrow_right',
pause: 1
@innbitcodes
innbitcodes / MySQL: Create DB in UTF8
Last active October 12, 2017 21:20
MySQL: Create Database in UTF8
CREATE DATABASE dbname DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON dbname.* TO 'dbuser' IDENTIFIED BY 'dbpassword';
flush privileges;
@innbitcodes
innbitcodes / Get query string value from URL
Created December 26, 2013 09:34
Demostration of getting query string values from URL
<script>
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&amp;");
for (var i=0;i&lt;vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
@innbitcodes
innbitcodes / Customization for .bashrc
Created January 3, 2014 05:55
Bash Prompt Customization Code
export PATH=~/bin:$PATH
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
@innbitcodes
innbitcodes / PHP: connect to MySQL with PDO
Created January 5, 2014 10:14
Way to connect MySQL with PDO method in PHP
<?php
try{
$db = new PDO("mysql:host=HOST_NAME;dbname=DB_NAME;port=PORT_NUM", "USER", "PASS");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->exec("SET NAMES 'utf8'");
} catch (Exception $e) {
echo "Could not connect to database.";
exit;
}
@innbitcodes
innbitcodes / Apache: remove virtual host
Created January 7, 2014 13:57
Remove virtual host from Apache server
sudo a2dissite sitename
sudo /etc/init.d/apache2 reload
sudo rm /etc/apache2/sites-available/sitename
@innbitcodes
innbitcodes / Ubuntu: SDK Installation
Created January 8, 2014 18:15
Ubuntu SDK installation commands
// Ubuntu 12.04 LTS, 12.10, 13.04 and 13.10
sudo add-apt-repository ppa:ubuntu-sdk-team/ppa && sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get install ubuntu-sdk
// Ubuntu development release
sudo apt-get update && sudo apt-get install ubuntu-sdk
@innbitcodes
innbitcodes / Bash: Install vcprompt
Created January 9, 2014 20:32
vcprompt installation in Terminal command line
cd; mkdir ~/bin && curl -sL https://github.com/djl/vcprompt/raw/master/bin/vcprompt > ~/bin/vcprompt && chmod 755 ~/bin/vcprompt && sudo mv ~/bin/vcprompt /bin/vcprompt && sudo rm -rf ~/bin