Skip to content

Instantly share code, notes, and snippets.

View aaryan79831014's full-sized avatar

Ramasamy Solaiappan aaryan79831014

View GitHub Profile
void Main()
{
string pattern = @"^(AB|DD|DG|EH|FK|G|HS|IV|KA|KW|KY|ML|PA|PH|TD|ZE)\d{1,2}\s?(\d[\w]{2})";
string postcode = "AB6 5DD";
Match match = Regex.Match(postcode, pattern, RegexOptions.IgnoreCase);
if (match.Success)
{
"Scotland".Dump();
For Learning Azure
https://docs.microsoft.com/en-gb/learn/paths/azure-fundamentals/
https://docs.microsoft.com/en-gb/learn/paths/store-data-in-azure/
https://docs.microsoft.com/en-us/learn/paths/deploy-a-website-with-azure-app-service/
https://docs.microsoft.com/en-gb/learn/paths/administer-containers-in-azure/
@aaryan79831014
aaryan79831014 / IIS Redirect
Created July 3, 2019 11:45
Scott Gu's tutorial IIS Redirect
Scott Gu
https://weblogs.asp.net/scottgu/tip-trick-fix-common-seo-problems-using-the-url-rewrite-extension
@aaryan79831014
aaryan79831014 / media.css
Created April 30, 2019 15:06
Media CSS Query for Devices
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
}
/*
##Device = Laptops, Desktops
##Screen = B/w 1025px to 1280px
@aaryan79831014
aaryan79831014 / Good_Reads.txt
Last active April 29, 2019 07:12
Good Reads URLs
CSS - Hand Book
-----------------
https://medium.freecodecamp.org/the-css-handbook-a-handy-guide-to-css-for-developers-b56695917d11
PDF -
https://flaviocopes.com/page/ebooks-links/
@aaryan79831014
aaryan79831014 / addjquerytoConsole.js
Last active March 20, 2019 22:48
Inject jquery support to the chrome browser console
//Run the following in console, this should add jquery support to the head of the document, then jquery can be used in console
var script = document.createElement('script');script.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js";document.getElementsByTagName('head')[0].appendChild(script);
@aaryan79831014
aaryan79831014 / GenerateOrder.cs
Created January 19, 2019 12:38
Manually generating an order in Merchello
//ORGINALLY TAKEN FROM https://gist.github.com/rustyswayne/598049064a02fce1597c
//------------------------------------------------------------------------------
// Adding the shipmethod is typically done in the back office through the UI.
// Interested in the use case to dynamically add theses?
var key = Constants.ProviderKeys.Shipping.FixedRateShippingProviderKey;
var defaultCatalogKey = Constants.DefaultKeys.Warehouse.DefaultWarehouseCatalogKey;
// this would have to be done through the back office as it uses an internal service
var us = MerchelloContext.Current.Services.StoreSettingService.GetCountryByCode("US");
First method is try http://embedresponsively.com/
--------------
Second Method
---------------
CSS
.video-container {
position: relative;
padding-bottom: 56.25%; /*16:9*/
@aaryan79831014
aaryan79831014 / Web.Config.txt
Last active January 9, 2019 09:22
Web.config SecurityConfig
Refer https://github.com/east-sussex-county-council/Escc.Web.SecurityConfig
**Content Security Policy is quite a bit of restricting the contents that the client can have, so had to be thought out before implementing**
Content-Security-Policy - This is pretty hard to implement as this http-header is to whitelist what contents are allowed in the web site.
Refer : https://rehansaeed.com/content-security-policy-for-asp-net-mvc/ & https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
<add name="X-Frame-Options" value="SAMEORIGIN" />
<add name="X-Content-Type-Options" value="nosniff" />
@aaryan79831014
aaryan79831014 / HomeController.cs
Last active December 21, 2018 23:18
iTextSharp to print pdf
using iTextSharp.text;
using iTextSharp.text.html.simpleparser;
using iTextSharp.text.pdf;
using iTextSharp_PDF.Services;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Hosting;