Skip to content

Instantly share code, notes, and snippets.

View walleyuan's full-sized avatar

Zhen YUAN walleyuan

View GitHub Profile
import React from 'react';
import {Component1} from 'qbe-jss-library';
const Card3 = (props) => (
<div>
<h2>QBE Component Library Demo</h2>
<Component1
heading={props.fields.heading}
image ={props.fields.sample1}
content={props.fields.content}/>
import React from 'react';
import { Text, Image, RichText } from '@sitecore-jss/sitecore-jss-react';
const Component1 = (props) => (
<div>
<Image
field={props.image}
srcSet={[{ mw: 300 }, { mw: 100 }]}
sizes="(min-width: 960px) 300px, 100px"
className="img-fluid"
IConfidentialClientApplication graphCca = ConfidentialClientApplicationBuilder.Create(graphClientId)
.WithClientSecret(graphSecret)
.WithRedirectUri(redirectUri)
.WithAuthority(graphAuthority)
.Build();
var authResult = await graphCca.AcquireTokenForClient(graphScopes).ExecuteAsync();
var token = authResult.AccessToken;
<add key="aad.GraphClientId" value="" />
<add key="aad.GraphSecret" value="" />
<add key="aad.GraphAuthority" value="https://login.microsoftonline.com/{0}" />
<add key="aad.RequestUrl" value="https://graph.microsoft.com/v1.0/users/{0}/memberOf?$select=displayName" />
<add key="aad:GraphScopes" value="https://graph.microsoft.com/.default" />
public class ExportFormDataToExcel
{
public void Process(FormExportArgs args)
{
Context.Job?.Status.LogInfo(DependenciesManager.ResourceManager.Localize("EXPORTING_DATA"));
string parameter = args.Parameters["contextUser"];
Assert.IsNotNullOrEmpty(parameter, "contextUser");
using (new UserSwitcher(parameter, true))
{
XmlDocument doc = new XmlDocument();
@walleyuan
walleyuan / gist:c39f7646134232b7e9fbca1e9fb8b16b
Last active October 31, 2017 23:11
Install Sitecore PowerShell Scripts
#define parameters
$prefix = "sc90"
$PSScriptRoot = "D:\Sitecore9"
$XConnectCollectionService = "$prefix.xconnect"
$sitecoreSiteName = "$prefix.local"
$SolrUrl = "https://localhost:8983/solr"
$SolrRoot = "C:\Bitnami\solr-6.6.2"
$SolrService = "solr6.6.2"
$SqlServer = "ZHENY\SQLEXPRESS01"
$SqlAdminUser = "sa"
@walleyuan
walleyuan / gist:f01a30889bef2fef0ee2754ca0e036f9
Created October 31, 2017 23:03
Install Sitecore Framework
# Add the Sitecore MyGet repository to PowerShell
Register-PSRepository -Name SitecoreGallery -SourceLocation https://sitecore.myget.org/F/sc-powershell/api/v2
# Install the Sitecore Install Framwork module
if (Get-Module -ListAvailable -Name SitecoreInstallFramework)
{
Write-Host "SitecoreInstallFramework module exists"
}
else
{
define(["sitecore", "/-/speak/v1/experienceprofile/DataProviderHelper.js", "/-/speak/v1/experienceprofile/CintelUtl.js"], function (sc, providerHelper, cintelUtil) {
var app = sc.Definitions.App.extend({
initialized: function ()
{
var localUrl = "/subscriptions/";
providerHelper.setupHeaders([
{ urlKey: localUrl }
]);
[AuthorizedReportingUserFilter]
public class ContactSubscriptionsController: ApiController
{
[HttpGet]
public object GetSubscriptionFields(Guid contactId)
{
try
{
var contactManager = GetContactManager();
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<ioc>
<processor type="EssentialEnergy.Feature.Media.Pipelines.IoC.RegisterMediaServices, EssentialEnergy.Feature.Media" />
</ioc>
</pipelines>
</sitecore>
</configuration>