Skip to content

Instantly share code, notes, and snippets.

View cwparsons's full-sized avatar

cwparsons

View GitHub Profile

ClientSidePages translation error

While trying to provision a translated pnp:ClientSidePage, I got the error:

The web has source language 1033 while the template expects 0

Turns out the original pnp:ClientSidePage needed to have my source language in an LCID attribute, which was missing.

@cwparsons
cwparsons / Pull.ps1
Created March 3, 2022 16:39
Runs `git pull --rebase origin master` on each subfolder that contains a .git folder using PowerShell.
# Runs `git pull --rebase origin master` on each subfolder that contains a .git folder.
Get-ChildItem -Directory -Hidden -Depth 3 -Filter .git | ForEach-Object { & git --git-dir="$($_.FullName)" --work-tree="$(Split-Path $_.FullName)" pull --rebase origin master }

macOS Setup

homebrew casks

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install --cask figma firefox google-chrome imageoptim microsoft-edge microsoft-remote-desktop powershell sublime-text visual-studio-code vlc watchguard-mobile-vpn-with-ssl

Sample public gist

@cwparsons
cwparsons / adaptive-card.json
Last active January 12, 2022 23:28
Adaptive card example with all text and containers
{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.3",
"body": [
{
"type": "Container",
"items": [
{
"type": "Container",
/**
* Create a SharePoint theme context provider, allowing children components to
* use the SharePoint theme and update when the theme changes.
*
* Usage:
* ```typescript
* <SpThemeProvider observer={this} serviceScope={this.context.serviceScope}>
* {children}
* </SpThemeProvider>
* ```

The 500 Greatest Albums of All Time

Rolling Stone's article

Last.fm profile

Before starting this listening journey, I am estimating I have listened to around 60 of the 500 albums. A raw CSV file is below.

Albums

@cwparsons
cwparsons / sample-web-part.tsx
Created February 28, 2020 17:01
Detect if an SharePoint Framework (SPFx) web part is in display mode or not, using TypeScript.
import { DisplayMode } from '@microsoft/sp-core-library';
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import * as React from 'react';
import * as ReactDom from 'react-dom';
export default class SampleWebPart extends BaseClientSideWebPart<{}> {
public render() {
ReactDom.render(
<div>
{this.displayMode === DisplayMode.Edit ? <span>Edit mode</span> : null}
-- https://mystery.knightlab.com/
select description from crime_scene_report
where type = "murder"
and city = "SQL City"
and date = "20180115"
-- Security footage shows that there were 2 witnesses.
-- The first witness lives at the last house on "Northwestern Dr".
-- The second witness, named Annabel, lives somewhere on "Franklin Ave".
<%@ Page Language="C#" AutoEventWireup="true" %>
<script runat="server">
// https://patrickdelancy.com/2015/01/compare-contrast-ways-programmatically-publish-sitecore-items/
protected string Result;
protected void Page_Load(object sender, System.EventArgs e)
{
Result = "";