Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Open to new opportunities

Oleksandr Skrypnyk villian

🏠
Open to new opportunities
View GitHub Profile
View ExamineComponent.cs
public class ProductComponent : IComponent
{
private readonly IExamineManager _examineManager;
private readonly ProductIndexCreator _productIndexCreator;
public ProductComponent (IExamineManager examineManager, ProductIndexCreator productIndexCreator)
{
_examineManager = examineManager;
_productIndexCreator = productIndexCreator;
}
@villian
villian / index.html
Created Feb 18, 2021 — forked from paulozoom/index.html
Async non-render-blocking loading of cloud.Typography’s typefaces
View index.html
<!-- loadCSS with async -->
<script async="async" src="/assets/loadcss.js" type="text/javascript"></script>
<!-- preload the fonts -->
<link as="style" href="https://cloud.typography.com/[…].css" onload="this.rel='stylesheet'" rel="preload" />
<!-- non-JS fallback -->
<noscript>
<link href="https://cloud.typography.com/[…].css" media="screen" rel="stylesheet" type="text/css" />
</noscript>
View controller.cs
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Contact(ContactModel model)
{
var response = Request["g-recaptcha-response"];
string secretKey = ""; // Ur secretKey
var webClient = new WebClient();
var result = webClient.DownloadString(string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secretKey, response));
var obj = JObject.Parse(result);
var status = (bool)obj.SelectToken("success");
View disable-html-form-input-autocomplete-autofill.md

Disable HTML Form Input Autocomplete and Autofill

  1. Add autocomplete="off" onto <form> element;
  2. Add hidden <input> with autocomplete="false" as a first children element of the form.
<form autocomplete="off" method="post" action="">
    <input autocomplete="false" name="hidden" type="text" style="display:none;">
    ...
@villian
villian / Bootstrap.cs
Created Oct 16, 2020 — forked from mattbrailsford/Bootstrap.cs
Indexing JSON values in Umbraco
View Bootstrap.cs
public class Bootstrapper : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
base.ApplicationStarted(umbracoApplication, applicationContext);
ExamineManager.Instance.IndexProviderCollection["ExternalIndexer"]
.GatheringNodeData += (sender, e) =>
{
// Extract JSON properties
@villian
villian / Umbraco 7: Cleaning out UrlTracker
Created Aug 31, 2020
Umbraco 7: Cleaning out UrlTracker
View Umbraco 7: Cleaning out UrlTracker
SET NOCOUNT ON;
DECLARE @r INT;
SET @r = 1;
WHILE @r > 0
BEGIN
BEGIN TRANSACTION;
@villian
villian / Linkedin: Accept all pending invitations, run in browser console
Created May 5, 2020
Linkedin: Accept all pending invitations, run in browser console
View Linkedin: Accept all pending invitations, run in browser console
var x = document.getElementsByClassName('invitation-card__action-btn artdeco-button'); for (var i=0 ;
i<x.length; i++) x[i].click();
@villian
villian / CloudFlare Flexible SSL Redirect Loop on ASP.Net Umbraco nopCommerce website
Last active Apr 29, 2020
CloudFlare Flexible SSL Redirect Loop on ASP.Net Umbraco nopCommerce website. Cloudflare appends the CF-Visitor HTTP header as explained: <pre>CF-Visitor: {"scheme":"https"}</pre> For this reason, the respective web.config <rewrite> snippet which worked for us is the following:
View CloudFlare Flexible SSL Redirect Loop on ASP.Net Umbraco nopCommerce website
<rewrite>
<rules>
<rule name="Redirect to https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_CF_VISITOR}" pattern="(.*)https(.*)" ignoreCase="true" negate="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" redirectType="Permanent" />
</rule>
</rules>