Skip to content

Instantly share code, notes, and snippets.

View dylanyoung-dev's full-sized avatar
🥑
Focusing

Dylan Young dylanyoung-dev

🥑
Focusing
View GitHub Profile
@vtml
vtml / choco-packages-for-sitecore-docker-build.ps1
Last active March 10, 2021 09:35
A list of Chocolatey packages required to install on a Windows VM to build Sitecore Docker Containers
Set-ExecutionPolicy RemoteSigned -Force; Set-ExecutionPolicy Unrestricted -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install dotnetcore -y
choco install dotnetcore-sdk -y
choco install webdeploy -y
choco install dotnetfx -y
choco install netfx-4.8 -y
choco install powershell-core -y
choco install azure-cli -y
choco install git -y
choco install sourcetree -y
@aweber1
aweber1 / __readme.md
Last active February 27, 2021 02:38
JSS Rendering Host

Description

The files in this gist demonstrate a fairly basic setup for a JSS rendering host.

DISCLAIMER: No guarantees that the code actually runs as-is. It was largely edited in place, so there may be typos or small syntax errors that you'll need to correct in your editor of choice. Feel free to leave a comment with any necessary fixes.

  • Sitecore config: jss-app-config.config This file is meant to show you how to setup your app config to use an external rendering host.

  • Entry point: jss-rendering-host-tunnel.js

@cassidydotdk
cassidydotdk / gulp-config.js
Last active January 31, 2023 15:49
Task to build and publish a .SLN file from gulp using "msbuild" instead of "gulp-msbuild". Version 16.0 for VS2019, use 15.0 for VS2017.
module.exports = function () {
var config = {
websiteRoot: "C:\\inetpub\\wwwroot\\sc911.sc",
sitecoreLibraries: "C:\\inetpub\\wwwroot\\sc911.sc\\bin",
hostName: "http://sc911.sc",
solutionName: "sc911",
buildConfiguration: "Debug",
runCleanBuilds: false,
toolsVersion: "16.0"
}
@nickwesselman
nickwesselman / ProductRepository.cs
Last active January 26, 2024 19:33
Unit Testing Sitecore ContentSearch (LINQ to Sitecore) using Moq
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Sitecore.Abstractions;
using Sitecore.ContentSearch;
using Sitecore.Data.Items;
namespace BasicCompany.Feature.Products.Services
{
public class ProductRepository : IProductRepository
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;
@KristofferK
KristofferK / euclidean-distance.ts
Last active October 23, 2023 19:00
Calculate the euclidean distance using TypeScript. Supports N dimensions.
const calculateDistance = (p: number[], q: number[]) => {
if (p.length != q.length) return -1;
const subtracted = q.map((i, n) => i - p[n]);
const powered = subtracted.map(e => Math.pow(e, 2));
const sum = powered.reduce((total, current) => total + current, 0)
return Math.sqrt(sum);
}
// Three dimension
const p = [2.15, 16.5, 5.6];
@jermdavis
jermdavis / Install-Solr.ps1
Last active November 23, 2021 13:30
A PowerShell script to help installing Solr as a service - See https://blog.jermdavis.dev/posts/2017/low-effort-solr-installs for details
Param(
$solrVersion = "6.6.2",
$installFolder = "c:\solr",
$solrPort = "8983",
$solrHost = "solr",
$solrSSL = $true,
$nssmVersion = "2.24",
$JREVersion = "1.8.0_151"
)
@viviandeveloper
viviandeveloper / ContentSearchTesting.cs
Last active October 20, 2023 10:33
Solution to the wretched "There is no method 'GetResults' on type 'Sitecore.ContentSearch.Linq.QueryableExtensions' that matches the specified arguments" error when unit testing search. Sitecore is tightly coupled to their own implemention of IQueryProvider which contains an 'Execute' method not found on standard .Net implementions.
namespace Testing
{
public class NewsController_LatestNews
{
[Theory]
[AutoData]
public void Should_be_news_items_ordered_by_date_descending(IEnumerable<NewsResultItem> newsResultItems)
{
var searchContext = Substitute.For<IProviderSearchContext>();
var queryable = new LuceneProviderQueryableStub(enumerable);
@michaellwest
michaellwest / Config_Enable-Disable_Sitecore_8.1_upd3.csv
Last active June 20, 2024 12:45
The following script imports the specified Sitecore Role configuration csv and automatically enables or disables the configs.
Product Filepath Filename DefaultExtension Provider CD CM PRC CMP RPT
Platform \website\ Web.config config Enable Enable Enable Enable Enable
Platform \website\App_Config\ Commands.config config Enable Enable Enable Enable Enable
Platform \website\App_Config\ ConnectionStrings.config config Enable Enable Enable Enable Enable
Platform \website\App_Config\ ConnectionStringsOracle.config config Enable Enable Enable Enable Enable
Platform \website\App_Config\ FieldTypes.config config Enable Enable Enable Enable Enable
Platform \website\App_Config\ Icons.config config Enable Enable Enable Enable Enable
Platform \website\App_Config\ LanguageDefinitions.config config Enable Enable Enable Enable Enable
Platform \website\App_Config\ MimeTypes.config config Enable Enable Enable Enable Enable
Platform \website\App_Config\ Portraits.config config Enable Enable Enable Enable Enable