Snippets are the most useful when you want to re-use a shell command or a specific code pattern. Here are a few we have in our library:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// send parameter | |
var url = '../ApprovalReportViewer.aspx?docBaseId=' + aData.Doc_Type + "&docCode=" + aData.Code + "&docVersion=" + aData.Version; | |
window.open(url, '_blank'); // <- This is what makes it open in a new window. | |
//Get parameter | |
var docBaseId = $.url().param('docBaseId'); | |
var docCode = $.url().param('docCode'); | |
var docVersion = $.url().param('docVersion'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TransferDt.Columns.Add("Receive Qty"); // Add column | |
TransferDt.Columns["Receive Qty"].SetOrdinal(24); // set column position | |
TransferDt.Columns["buyer_po_number"].ColumnName = "PO Number"; | |
TransSpecDt.AcceptChanges(); | |
grdProductTransfar.Columns["Code"].Visible = false; | |
grdProductTransfar.Columns["Receive Qty"].DefaultCellStyle.BackColor = Color.LightGoldenrodYellow; | |
int index = grdProductTransfar.SelectedCells[0].ColumnIndex; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Removes all elements from the plan cache, removes a specific plan from | |
the plan cache by specifying a plan handle or SQL handle, | |
or removes all cache entries associated with a specified resource pool.*/ | |
EXEC DBCC FREEPROCCACHE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DateTime firstDate = orderDt.AsEnumerable().Select(cols => cols.Field<DateTime>("Ship Date")).OrderBy(p => p.Ticks).FirstOrDefault(); | |
DateTime LastDate = orderDt.AsEnumerable().Select(cols => cols.Field<DateTime>("Ship Date")).OrderByDescending(p => p.Ticks).FirstOrDefault(); | |
DateTime maxDate = firstDate.AddMonths(1); | |
if (maxDate < LastDate) | |
{ | |
// Do something. | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
NewerOlder