Skip to content

Instantly share code, notes, and snippets.

Avatar

Kent Safranski ksafranski

View GitHub Profile
View model_validation.js
var validate = function (data, model, cb) {
var failures = [];
var regEx;
var validJSON;
var processNode;
var result;
var traverseNodes;
// Define common regular expressions
@ksafranski
ksafranski / index.html
Created Feb 23, 2014
Demo UI for DozerJS TodoList App Tutorial
View index.html
<!DOCTYPE html>
<html>
<head>
<title>DozerJS TodoList</title>
<link rel="stylesheet" href="screen.css">
</head>
@ksafranski
ksafranski / codio.sh
Last active Aug 29, 2015
Codio Setup
View codio.sh
echo "zsh && exit 0" >> ~/.bash_profile &&
curl -L http://install.ohmyz.sh | sh
View websocket-only.js
// Client-side
io.connect({
forceNew: true,
transports: [ 'websocket' ]
});
// Server-side
var io = require('socket.io');
var app = require('express')();
var server = require('http').createServer(app);
View JSON_PHP_Encapsulation.php
/*
* This script allows saving & retrieval of JSON data in .php files by
* encapsulating in a <?php/*| ... |*/?> closure, preventing them from
* being accessed via URL.
*/
//////////////////////////////////////////////////////////////////////
// Get JSON
/////////////////////////////////////////////////////////////////////
@ksafranski
ksafranski / CSS-Self-Clear.css
Created Jun 21, 2012
Easy self-clear for floats
View CSS-Self-Clear.css
/* clearing floats normal browsers */
.group:after {
content: "";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
/* clearing floats IE6 */
@ksafranski
ksafranski / GetIPAddress.php
Created Jun 29, 2012
Reliable method for getting visitor IP Address
View GetIPAddress.php
function getIP(){
if (!empty($_SERVER['HTTP_CLIENT_IP'])){
$ip=$_SERVER['HTTP_CLIENT_IP'];
}elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}else{ $ip=$_SERVER['REMOTE_ADDR']; }
return $ip;
}
@ksafranski
ksafranski / jquery.rotator.js
Created Jul 17, 2012
Simple jQuery Rotator with all the goodies
View jquery.rotator.js
/*
*
* Another fine bit of code by Kent Safranski < http://www.fluidbyte.net >
*
* HTML:
* <ul id="banner">
* <li>Stuff</li>
* ...
* </ul>
*
@ksafranski
ksafranski / jquery.autocomplete.js
Created Aug 9, 2012
Simple jQuery Autocomplete plugin
View jquery.autocomplete.js
/*
*
* Simple Autocomplete Plugin
* @author - Kent Safranski - http://www.fluidbyte.net
*
* HTML:
* --------------------------------------------------------------------
* <input class="autocomplete" data-src="path/to/processor.php" />
*
* CSS:
@ksafranski
ksafranski / DumGrid.css
Created Aug 14, 2012
DumGrid For Responsive Inline-Block Grid Layout
View DumGrid.css
/*
*
* Inline-Block CSS Responsive Grid System
*
* <!-- 2 Column with 10% Gutter -->
* <div class="grid column-45 gutter-10"></div>
* <div class="grid column-45"></div>
*
* <!-- 3 Column with 5% Gutter -->
* <div class="grid column-30 gutter-5"></div>