Skip to content

Instantly share code, notes, and snippets.

Alex Smagin asmagin

Block or report user

Report or block asmagin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@asmagin
asmagin / index.jsx
Created Jan 18, 2019
SafePureComponent
View index.jsx
import * as React from 'react';
import * as Models from './models';
export class SafePureComponent<P, S extends Models.SafePureComponentState> extends React.PureComponent<P, S> {
private hasError: boolean = false;
constructor(props: P, context?: any) {
super(props, context);
}
@asmagin
asmagin / set JAVA_HOME.ps1
Created Nov 6, 2017
Install Sitecore 9 - Prerequisites - Part 10 - Install Solr 6.6.2 - Set JAVA_HOME & Path
View set JAVA_HOME.ps1
# set JAVA_HOME and Path variables
$JAVA_HOME = "C:\Program Files\Java\jre1.8.0_151"
$Path = "${env:Path};${JAVA_HOME}\bin"
[Environment]::SetEnvironmentVariable("JAVA_HOME", $JAVA_HOME, "Machine")
[Environment]::SetEnvironmentVariable("Path", $Path, "Machine")
@asmagin
asmagin / Engine.cs
Last active Oct 22, 2016
Js Engine Performance Tests
View Engine.cs
public class Engine : IDisposable
{
private IJsPool pool;
private string initJs;
public Engine()
{
//JsEngineSwitcher.Instance.EngineFactories.AddMsie(new MsieSettings() { EngineMode = JsEngineMode.Auto });
//JsEngineSwitcher.Instance.DefaultEngineName = MsieJsEngine.EngineName;
@asmagin
asmagin / AssemblyRegistration.cs
Last active Mar 15, 2019
Sitecore Redux solution
View AssemblyRegistration.cs
using JavaScriptEngineSwitcher.Core;
using React;
using React.TinyIoC;
namespace Smagin.Alex.React
{
/// <summary>
/// Handles registration of core ReactJS.NET components.
/// </summary>
public class AssemblyRegistration : IAssemblyRegistration
View SimpleContentComponent.js
'use strict';
import React from 'react';
import { Grid, Row, Col } from 'react-bootstrap'
require('styles/common/SimpleContent.css');
let yeomanImage = require('../../images/yeoman.png');
View Catalog Repository.cs
private MultipleProductSearchResults GetMultipleProductSearchResults(BaseItem dataSource,
CommerceSearchOptions productSearchOptions)
{
Assert.ArgumentNotNull(productSearchOptions, "productSearchOptions");
MultilistField searchesField = dataSource.Fields[Templates.ProductSearch.Fields.NamedSearches.ToString()];
var searches = searchesField.GetItems();
var productsSearchResults = new List<SearchResults>();
foreach (var search in searches)
View Catalog - Action - ProductRecommendation.cs
/// <summary>
/// An action to manage data for the ProductList
/// </summary>
/// <param name="pageNumber">The page number.</param>
/// <param name="facetValues">The facet values.</param>
/// <param name="sortField">The sort field.</param>
/// <param name="sortDirection">The sort direction.</param>
/// <returns>
/// The view that represents the ProductList
/// </returns>
@asmagin
asmagin / GenerateSitecoreNugetPackages.ps1
Last active Oct 3, 2019
Powershell script to generate nuget packages with dependencies
View GenerateSitecoreNugetPackages.ps1
param(
[string] $Major = "8",
[string] $Minor = "1",
[string] $Update = "0",
[string] $Date = "151003",
[string] $nugetPath = ".\tools\nuget.exe",
[string] $downloadsPath = ".\downloads",
[string] $nuspecTemplate = ".\tools\package.nuspec.xml",
[string] $apiKey,
[string] $nugetFeed = "http://use-your.own/nuget/Sitecore-Libs"
View YAML vs JSON.cs
using System;
using System.IO;
using Newtonsoft.Json;
using YamlDotNet.Serialization;
internal class Program
{
private const int count = 10000;
View designer.html
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-scroll-header-panel/core-scroll-header-panel.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
You can’t perform that action at this time.