Skip to content

Instantly share code, notes, and snippets.

View cgkio's full-sized avatar

Christian Kessler IV cgkio

View GitHub Profile
@cgkio
cgkio / index.html
Created July 8, 2015 19:48
How to center a responsive element horizontally and vertically while using Bootstrap
<div class="vertical-center">
<img src="img/logo.png" class="img-responsive center-block" alt="My Logo">
<button class="btn btn-default btn-lg spacer">Discover the Button</button>
</div>
<!-- src: http://www.wiredmark.com/center-responsive-element-horizontally-vertically-using-bootstrap/ -->
/*! Firebase-util - v0.1.2 - 2014-01-11
* https://github.com/firebase/firebase-util
* Copyright (c) 2014 Firebase
* MIT LICENSE */
(function(exports) {
/**
* @var {Object} a namespace to store internal utils for use by Firebase.Util methods
*/
@cgkio
cgkio / rec_for_jason.sh
Last active August 29, 2015 13:58
options for JH on getting Appgyver Steroids & iOS Simulator working on his Mac
echo "Downloading, compiling, and installing the latest stable release of node.js:"
nvm install 0.10.26
nvm use 0.10.26
echo "Setting 0.10.26 as the default:"
nvm alias default 0.10.26
echo "Displaying the current version of node.js:"
node -v
#!/bin/sh
echo "Do you wish to install this program?"
select yn in "Yes" "No"; do
case $yn in
Yes ) make install; break;;
No ) exit;;
esac
done
@cgkio
cgkio / install_git_raspberry_pi.sh
Created December 25, 2013 21:47
Raspberry Pi setup crib sheet (private)
sudo apt-get update
# node.js
wget http://node-arm.herokuapp.com/node_latest_armhf.deb
sudo dpkg -i node_latest_armhf.deb
node -v
# git
sudo apt-get install git
# heimcontrol.js
sudo apt-get install git-core git scons build-essential scons libpcre++-dev xulrunner-dev libboost-dev libboost-program-options-dev libboost-thread-dev libboost-filesystem-dev
git clone git://github.com/RickP/mongopi.git
@cgkio
cgkio / serialport_raspberry_pi.md
Created December 12, 2013 21:41
Install node.js serial port on Rasperry Pi
  • Starting with a a vanilla New Out of the Box Software (NOOBS) Raspbian image
  • Log into your Raspberry Pi through whatever means works best and ensure you are on a terminal prompt for the remaining steps. This could be local or through an SSH (or a serial connection if you like).
  • Issue the following commands to ensure you are up to date:
   sudo apt-get update
   sudo apt-get upgrade -y
  • Download and install node.js:
 wget http://node-arm.herokuapp.com/node_latest_armhf.deb
@cgkio
cgkio / return_first_word.js
Created December 11, 2013 21:56
match/return first word with REGEX
REGEX: match/return first word (before space)
var string = '130,000 037037032032';
var regex = /^\S*/g;
var result = string.match(regex);
@cgkio
cgkio / validate_email_address.js
Created December 11, 2013 19:53
Validate email address using REGEX
var $email = $('form input[name="email'); //change form to id or containment selector
var re = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/igm;
if ($email.val() == '' || !re.test($email.val()))
{
alert('Please enter a valid email address.');
return false;
}