Skip to content

Instantly share code, notes, and snippets.

Terra terra819

  • Dayton, OH
Block or report user

Report or block terra819

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@terra819
terra819 / jquery_onload.js
Created Mar 26, 2013
jquery document ready snippet
View jquery_onload.js
$(document).ready(function () {
// code to run on document ready
});
@terra819
terra819 / ajax_post_json.js
Created Mar 26, 2013
Ajax getter/setter with json formatted data
View ajax_post_json.js
$.ajax({
url: window.webRoot + 'Validations/SaveValidation',
data: JSON.stringify({data}),
type: "post",
contentType: "application/json",
success: function (resultData) {
// code to execute on success
}
});
@terra819
terra819 / jquery_ui_modal.js
Created Mar 26, 2013
Open jquery ui modal popup
View jquery_ui_modal.js
$("#divID").dialog({
title: 'Modal Window Title',
height: 250,
width: 650,
modal: true,
buttons: {
'OK': function () {
$(this).dialog('close');
} //Ok
}//buttons
@terra819
terra819 / webgrid.cshtml
Created Mar 26, 2013
Webgrid sample syntax
View webgrid.cshtml
@{
var grid = new WebGrid(Model, canSort: true, canPage: false, defaultSort: "Column1Value");
}
@grid.GetHtml(
columns: grid.Columns(
grid.Column("Column1Value", "Column 1 Heading", canSort: true),
grid.Column("Column2Value", "Column 2 Heading", canSort: true),
grid.Column("Actions",
format: @<text>
@Html.ActionLink("Action Link 1 Text", "ActionLink1Command") |
@terra819
terra819 / webgrid_moreoptions.cshtml
Created Mar 26, 2013
Webgrid sample syntax with more options, paging
View webgrid_moreoptions.cshtml
notes: default paging rows is 10, allow paging and allow sort is default = true. all attributes listed below are optional. a standard generic (auto gen col=true) can be called with a simple @grid.GetHtml()
@grid.GetHtml(
fillEmptyRows: true,
alternatingRowStyle: "alternate-row",
headerStyle: "grid-header",
footerStyle: "grid-footer",
mode: WebGridPagerModes.All,
firstText: "<< First",
previousText: "< Prev",
@terra819
terra819 / auto_crud_sproc_generator.sql
Created Mar 26, 2013
Auto generate crud sprocs. must grant permissions after running.
View auto_crud_sproc_generator.sql
SET NOCOUNT ON;
-- User Preferences
DECLARE @prefix varchar(5);
SET @prefix = 'usp_';
-- End User Preferences
-- Create CRUD procedures
DECLARE DBtables CURSOR FOR SELECT name FROM sysobjects WHERE xtype = 'u' AND name != 'sysdiagrams'
@terra819
terra819 / list_reports.vb
Created Mar 26, 2013
Get list of reports under a path and populate a dropdown list.
View list_reports.vb
' sample reporting server url http://MyServer/ReportServer/ReportService.asmx
Private Sub LoadSampleReports()
Dim rs As New ReportingService
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim item As CatalogItem
For Each item In rs.ListChildren("/SampleReports", False)
If item.Type = ItemTypeEnum.Report Then
DropDownList1.Items.Add(New ListItem(item.Name, item.Path))
@terra819
terra819 / get_table_sizes.sql
Created Mar 26, 2013
Get list of tables in a database with number of rows, reserved space, data, index_size and unused space.
View get_table_sizes.sql
declare @RowCount int, @tablename varchar(100)
declare @Tables table (
PK int IDENTITY(1,1),
tablename varchar(100),
processed bit
)
INSERT into @Tables (tablename)
SELECT TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_TYPE = 'BASE TABLE' and TABLE_NAME not like 'dt%' order by TABLE_NAME asc
declare @Space table (
name varchar(100), rows nvarchar(100), reserved varchar(100), data varchar(100), index_size varchar(100), unused varchar(100)
You can’t perform that action at this time.