Skip to content

Instantly share code, notes, and snippets.

View MarshalOfficial's full-sized avatar
💻

Reza MarshalOfficial

💻
View GitHub Profile
@MarshalOfficial
MarshalOfficial / owasp-dotnet-security-cheat-sheet.md
Last active May 12, 2024 17:30
owasp-dotnet security cheat sheet reference
@MarshalOfficial
MarshalOfficial / PagedList.cs
Created May 12, 2024 06:13
a generic implementation of C# paged list to be used by linq iqueriable
public class PagedList<T> : List<T>
{
public int current_page { get; set; }
public int total_pages { get; set; }
public int page_size { get; set; }
public int total_count { get; set; }
public bool has_previous => current_page > 1;
public bool has_next => current_page < total_pages;
public PagedList()
@MarshalOfficial
MarshalOfficial / asp-net-generic-confirmation-modal.md
Created May 11, 2024 06:26
a generic reusable confirmation modal for asp.net mvc or razor pages application, uses bootstrap and jquery
  1. Create a Partial View for the Modal: Create a partial view named _ConfirmationModal.cshtml that contains the HTML for your confirmation modal:

    <!-- _ConfirmationModal.cshtml -->
    <div id="confirmationModal" class="modal fade" tabindex="-1" role="dialog">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">Confirmation</h5>
@MarshalOfficial
MarshalOfficial / asp-razor-pages-country-cities-drop-down-ajax.md
Created May 11, 2024 06:18
Countries and cities drop downs manipulation in asp.net razor pages project

Assuming you have a Razor Page named Index.cshtml, here's how you can implement the dynamic population of cities based on the selected country using AJAX and jQuery:

  1. Design the UI: In your Index.cshtml, create two dropdown lists - one for countries and one for cities:

    <select id="countryDropdown">
        <option value="">Select Country</option>
        <!-- Populate countries dynamically if needed -->
    </select>
@MarshalOfficial
MarshalOfficial / asp-mvc-country-cities-drop-down-ajax.md
Created May 11, 2024 06:17
Countries and cities drop down manipulation in asp.net MVC project
  1. Create Razor Page: Create a new Razor Page named Index.cshtml or any other relevant name.

  2. Design the UI: In your Razor Page's HTML markup, create two dropdown lists - one for countries and one for cities:

    <select id="countryDropdown">
        <option value="">Select Country</option>

DOM Manipulation:

  1. Selecting Elements:

    • $(selector): Selects elements based on CSS-style selectors.
    • $('#elementId'): Selects an element by its ID.
    • $('.className'): Selects elements by their class name.
  2. Manipulating Elements:

    • .html(): Gets or sets the HTML content of an element.
    • .text(): Gets or sets the text content of an element.
@MarshalOfficial
MarshalOfficial / jquery-ajax-cheat-sheet.md
Created May 11, 2024 05:57
jquery ajax handy cheat sheet

jQuery AJAX Cheat Sheet

1. Making a GET Request:

$.ajax({
    url: 'YourAPIEndpoint',
    type: 'GET',
    success: function(response) {
        // Handle successful response
    },
@MarshalOfficial
MarshalOfficial / find-sps-that-contain-a-specific-word.sql
Created January 14, 2024 09:33
find all sps that contain specific word in sql server
SELECT OBJECT_NAME(object_id) AS Procedure_Name FROM sys.sql_modules(nolock) WHERE definition LIKE '%31291%' AND OBJECTPROPERTY(object_id, 'IsProcedure') = 1
// Un retweet
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
for(var i = 1; i < 500; i++){
document.querySelectorAll('[data-testid="unretweet"]')[0].click()
await sleep(1000)
document.querySelectorAll('[data-testid="unretweetConfirm"]')[0].click()
await sleep(1000)
@MarshalOfficial
MarshalOfficial / sp_who_with_filter
Created January 28, 2023 14:53
sql server sp_who with filters
DECLARE @Table TABLE(
SPID INT,
Status VARCHAR(MAX),
LOGIN VARCHAR(MAX),
HostName VARCHAR(MAX),
BlkBy VARCHAR(MAX),
DBName VARCHAR(MAX),
Command VARCHAR(MAX),
CPUTime INT,
DiskIO INT,