Skip to content

Instantly share code, notes, and snippets.

View kapozade's full-sized avatar
🎯
focused on sth really matters..

Onur Kapçık kapozade

🎯
focused on sth really matters..
View GitHub Profile
@kapozade
kapozade / Jira-Branch-Name-Booklet
Last active January 14, 2021 15:38
Generates branch name and copies to clipboard.
javascript: (function ($) { var id = jQuery("#key-val").text(); var title = $("#summary-val").text(); var translate = {"ş": "s", "ö": "o", "ü": "u", "ı": "i", "ç": "c", "ğ":"g"}; var cleanedTitle = title.toLowerCase().replace(/[ğüşıöç]/g, function(match) { return translate[match]; }).replace(/[\s*]+/g, "-").replace(/^_/, "").replace(/_$/, ""); var cleanedId = id.toUpperCase().replace(/[ğüşıöç]/g, function(match) { return translate[match]; }).replace(/[s*]+/g, "-").replace(/^-/, "").replace(/-$/, ""); var storyType = "feature"; var branchName = storyType + "/" + cleanedId +"-" + cleanedTitle; navigator.clipboard.writeText(branchName); } )(jQuery);
@kapozade
kapozade / sonarqube-with-coverlet.ps1
Last active October 24, 2020 19:53
Sonarqube and Coverlet.
# Add or install "coverlet.msbuild" into your project. Run below command to see coverlet output XML files.
dotnet test xxx.test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
# Open a new PowerShell or CommandLine session. Run Sonarqube image.
docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube
# Check the latest version here https://www.nuget.org/packages/dotnet-sonarscanner and install the tool.
dotnet tool install --global dotnet-sonarscanner --version 4.10.0
# For each update, you made in your code, run the below commands.
@kapozade
kapozade / squah.md
Created August 11, 2020 11:24 — forked from shellkore/squah.md
squash your commits

SQUASH

Whenever you want to squash last commits in a single commit:-

first check your log

git log

CASE 1: your head is at the commit in which you want others to be squashed

@kapozade
kapozade / Precommit.md
Last active March 28, 2020 20:30
Run Prettier before commit - i.e, precommit

Need to install below as dev dependency (yarn add --dev husky lint-staged prettier)

  • prettier - prettify the files that has been declared.
  • husky - to run prettier before commit.
  • lint-staged - add changes during precommit stage to the commit.

Create .prettierrc.yml file and insert below content. This file should be at the root folder and you can configure as you wish.

trailingComma: 'es5'  
tabWidth: 2  
singleQuote: true  
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore role:require="Standalone or ContentDelivery or ContentManagement">
<pipelines>
<owin.identityProviders>
<processor type="Foundation.Authentication.IdentityProviderProcessor , Foundation.Authentication"
resolve="true" />
</owin.identityProviders>
</pipelines>
</sitecore>
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore role:require="Standalone or ContentDelivery or ContentManagement">
<!-- Enables Federated Auth -->
<settings>
<setting name="FederatedAuthentication.Enabled">
<patch:attribute name="value">true</patch:attribute>
</setting>
</settings>
using Sitecore.Owin.Authentication.Configuration;
using Sitecore.Owin.Authentication.Identity;
using Sitecore.Owin.Authentication.Services;
using System;
using Microsoft.AspNet.Identity.Owin;
namespace Foundation.Authentication
{
public class CreateUniqueUser : DefaultExternalUserBuilder
{
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.IdentityModel.Protocols;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Notifications;
using Microsoft.Owin.Security.OpenIdConnect;
using Owin;
using Sitecore.Owin.Authentication.Configuration;
using Sitecore.Owin.Authentication.Pipelines.IdentityProviders;
@kapozade
kapozade / ScreenshotController.cs
Created March 12, 2019 12:49
Return screenshot of a page by the help of Selenium. NetCore WebApi code.
using System;
using System.Drawing;
using System.IO;
using System.Reflection;
using Microsoft.AspNetCore.Mvc;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace ScreenshotApi.Controllers
{