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
javascript: void ((function () { | |
andiScript = document.createElement('script'); | |
andiScript.setAttribute('src', 'https://code.jquery.com/jquery-3.4.1.min.js'); | |
document.body.appendChild(andiScript) | |
})()); | |
// Description: The following script is configured to load jQuery on the page. | |
// Simply by changing the value of the "src" attribute, you can load your own scipts | |
// Setup: |
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
String.prototype.replaceAll = function replaceAll(find, replace) { | |
return this.replace(new RegExp(find, 'g'), replace); | |
} | |
// Example: "a sdsds a sdsd".replaceAll("a", "2") | |
// result: "2 sdsds 2 sdsd" | |
// Another option is to use it just as a function: | |
function replaceAll(str, find, replace) { |
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
<!-- Example | |
function myFunc(){ | |
log("some message"); | |
// some logic | |
log("some other message"); | |
} --> | |
<style> | |
#console { |
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
// How to get Connection string with C# | |
var connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["connectionStringName"].ConnectionString; | |
// Declare in web.config a ConnectionString to VisualStudio's LocalDB | |
<configuration> | |
<connectionStrings> | |
<add name="NorthwindConnectionString" connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|Northwind.mdf;Integrated Security=True" providerName="System.Data.SqlClient"/> | |
</connectionStrings> | |
// Declare in web.config a ConnectionString to DB existing in SQL Server |
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
// Check the currently active DOM element, similar to adding document.activeElement in the Google Chrome's live expression | |
// Chrome DevTools live expression docs: https://developers.google.com/web/updates/2018/08/devtools#watch | |
var currentActiveElement = document.activeElement; | |
console.log(currentActiveElement); | |
var interval = setInterval(function(){ | |
if(document.activeElement != currentActiveElement){ | |
currentActiveElement = document.activeElement; | |
console.log(currentActiveElement); | |
} |
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
// https://stackoverflow.com/a/4256130/10759760 | |
String.prototype.format = function () { | |
var formatted = this; | |
for (var i = 0; i < arguments.length; i++) { | |
var regexp = new RegExp('\\{' + i + '\\}', 'gi'); | |
formatted = formatted.replace(regexp, arguments[i]); | |
} | |
return formatted; | |
}; | |
// Sample usage: |
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
1. Open a file in Visual Studio | |
2. Press ctrl+H(shortcut for Find and replace) | |
3. Enable regex | |
4. Use the following expression ^\s*$\n and replace it with an empty string |
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
// Example how to use in RadTreeView and RadOrgChart at the end of file | |
private DataTable CreateHierarchicalDataTable(int[] nodesPerLevel) | |
{ | |
var dataTable = new DataTable(); | |
dataTable.Columns.Add("ID"); | |
dataTable.Columns.Add("ParentID"); | |
dataTable.Columns.Add("Text"); | |
dataTable.Columns.Add("Collapsed"); |
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
public DataTable GetDataTableSource() | |
{ | |
DataTable dataTable = new DataTable(); | |
dataTable.Columns.Add(new DataColumn("OrderID", typeof(int))); | |
dataTable.Columns.Add(new DataColumn("OrderDate", typeof(DateTime))); | |
dataTable.Columns.Add(new DataColumn("Freight", typeof(decimal))); | |
dataTable.Columns.Add(new DataColumn("ShipName", typeof(string))); | |
dataTable.Columns.Add(new DataColumn("ShipCountry", typeof(string))); |
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
// created based on https://stackoverflow.com/a/563442 | |
Date.prototype.addDays = function (days) { | |
days = days || 1; | |
var date = new Date(this.valueOf()); | |
date.setDate(date.getDate() + days); | |
return date; | |
} | |
Date.prototype.addMonths = function (months) { | |
months = months || 1; | |
var date = new Date(this.valueOf()); |
NewerOlder