Skip to content

Instantly share code, notes, and snippets.

View sholsinger's full-sized avatar

Steve Holsinger sholsinger

View GitHub Profile
@sholsinger
sholsinger / GetTableDefinitionADO.asp
Created March 9, 2011 16:54
Some functions to aid in "describing" a SQL table that you don't have direct SQL access to via COM ADO library.
<%
Function GetTableDefinition( table_name, conn, id, idfield )
dim rs, fld, rec
dim where: where = ""
If IsNumeric(id) And id > 0 and idfield <> "" Then
where = " WHERE " & idfield & " = " & id
End If
@sholsinger
sholsinger / proj_request_report.js
Created February 17, 2011 16:11
A quick and dirty report of the unique input names on my page.
var report = {
run: function ()
{
return $("form :input[name!='']").filter(this.isUniqueField);
},
isUniqueField: function (index)
{
if(report.elementNameCache.indexOf(this.name) < 0) {
@sholsinger
sholsinger / JSON.stringify.js
Created February 15, 2011 22:10
Apparently the standard is stringify() // Who decided that?!
if(JSON.hasOwnProperty('encode') && !JSON.hasOwnProperty('stringify')){
JSON.stringify = JSON.encode;
}
@sholsinger
sholsinger / Array.indexOf.js
Created February 9, 2011 22:59
Detect existence of Mozilla's indexOf Array extension and implement if not available.
if(Array.prototype.indexOf === undefined)
{
Array.prototype.indexOf = function(val)
{
for (var i = 0; i < this.length; i++)
{
if(this[i] == val)
return i;
}
return -1;
@sholsinger
sholsinger / SQL Parser Error (Text AND Category)
Created October 18, 2010 15:47
Parser tells me: Incorrect syntax near the keyword 'ORDER' -- which one?
DECLARE @str VARCHAR(255);
SELECT @str = LOWER(?);
SELECT * (
SELECT TOP 8 * FROM [oca_search_model]
WHERE [osm_isactive] = 1
AND LOWER([osm_category]) = LOWER(?)
AND (
LOWER([osm_keywords]) LIKE '%'+@str+'%'
OR LOWER([osm_description]) LIKE '%'+@str+'%'
OR LOWER([osm_name]) LIKE @str+'%'