Skip to content

Instantly share code, notes, and snippets.

View ritacse's full-sized avatar

Wahida Yasmin ritacse

  • Bangladesh
View GitHub Profile
@ritacse
ritacse / 0_reuse_code.js
Last active January 2, 2018 11:15
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
@ritacse
ritacse / cacher_intro.md
Created November 9, 2017 11:14
Here are a few tips to help you start building a code snippet library.

Getting Started with Cacher

Use snippets to quickly recall commands

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:

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.
}
/*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
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;
// 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');
IF EXISTS(SELECT * FROM [dbo].[PRoll_Company_Monthly_Salary_T_X] WHERE CompSalaryMonth =@month AND [CompSalaryYear] =@Year )
BEGIN
---DO something here
END
$(".txtNumber").alphanum({ allowLatin: false, maxLength: 7 });
$(".txtDesimal").numeric({
allowMinus: false,
allowThouSep: false,
maxDigits: 11,
maxDecimalPlaces: 2
});
$(".txtPhone").alphanum({ allow: '-+,', allowLatin: false });
//tab wise excel export from dataset with multiple table
if (yarnDS != null && yarnDS.Tables.Count > 0)
{
var wb = new XLWorkbook();
var wsCom = wb.Worksheets.Add("Company Job");
wsCom.Cell(1, 1).InsertTable(yarnDS.Tables[0].AsEnumerable());
var wsB = wb.Worksheets.Add("Buyer Company Job");
wsB.Cell(1, 1).InsertTable(yarnDS.Tables[1].AsEnumerable());
var wsR = wb.Worksheets.Add("Rejected Yarns");
<style>
.blink {
animation: blink-animation 1s steps(5, start) infinite;
-webkit-animation: blink-animation 1s steps(5, start) infinite;
}
@keyframes blink-animation {
to {
visibility: hidden;
}
}