Skip to content

Instantly share code, notes, and snippets.

@cemerson
cemerson / paging.sql
Created February 7, 2014 17:23
SQL: Paging in Stored Procedure
DECLARE @intStartRow int;
DECLARE @intEndRow int;
SET @intStartRow = (@intPage -1) * @intPageSize + 1;
SET @intEndRow = @intPage * @intPageSize;
WITH blogs AS
(SELECT strBlogName,
ROW_NUMBER() OVER(ORDER BY intID DESC) as intRow,
COUNT(intID) OVER() AS intTotalHits
@cemerson
cemerson / checkbox.js
Created February 11, 2014 11:42
JQUERY: get checkbox value
$('#mycheckbox').prop("checked"); // true or false
@cemerson
cemerson / index.html
Created February 11, 2014 19:47
HTML: Standard DocType (Strict)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
@cemerson
cemerson / console.log.js
Created February 16, 2014 12:02
JavaScript: Window Console Log Fix for IE
if (!window.console) window.console = {};
if (!window.console.log) window.console.log = function () { };
@cemerson
cemerson / report.js
Created February 16, 2014 12:03
JavaScript: Basic Log Function
if (!window.console) window.console = {};
if (!window.console.log) window.console.log = function () { };
function report(msg,ex){
if(!!ex) msg = 'ERROR in [' + msg + ']. Message: ' + ex.Message;
window.console.log(msg);
}
@cemerson
cemerson / querystring.js
Created February 16, 2014 15:51
JavaScript: Get QueryString URL Parameter value
function getURLParameter(name,usePoundInsteadOfQuestionMarkIfAvailable) {
var url = window.location.href;
// use #param=value method?
if(url.indexOf('?',0) == -1) usePoundInsteadOfQuestionMarkIfAvailable = true;
var poundExistsInURL = (url.indexOf('#',0) > -1);
if(
(usePoundInsteadOfQuestionMarkIfAvailable == true) &&
(poundExistsInURL)){
return getHashParams()[name];
@cemerson
cemerson / redirect.htm
Created February 19, 2014 13:56
HTML: MetaRefresh Redirect
<META http-equiv="refresh" content="0;URL=REDIRECT_TO_URL">
@cemerson
cemerson / decode.js
Created February 26, 2014 11:56
jQuery: Decode Escaped HTML
function decodeEscapedHTML (escapedHTML) {
var decodedHTML = $('<div/>').html(encodedText).text();
return decodedHTML;
}
@cemerson
cemerson / index.html
Created March 8, 2014 20:33
HTML: Meta NoCache
<meta http-equiv="EXPIRES" content="0">
<meta http-equiv="PRAGMA" content="NO-CACHE">
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
<META NAME="GOOGLEBOT" CONTENT="NOARCHIVE">
@cemerson
cemerson / 0_reuse_code.js
Created March 14, 2014 16:54
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console