Skip to content

Instantly share code, notes, and snippets.

View estruyf's full-sized avatar
:octocat:
Front Matter

Elio Struyf estruyf

:octocat:
Front Matter
View GitHub Profile
@estruyf
estruyf / gulpfile-change-packaging-settings.js
Last active April 29, 2024 07:30
Gulp SPFx tasks for changing environment settings
/**
This gulp task can be used to update environment configuration of the current project.
All settings are stored in a file: ./config/package-solution-env-settings.json
Example settings:
{
"environments": [{
"environment": "default",
"id": "7E60EE1A-512E-4E2B-88B2-EF61103936F8",
@estruyf
estruyf / extension.ts
Created December 22, 2023 08:20
Comment style sample from Wes Bos
import * as vscode from "vscode";
export function activate(context: vscode.ExtensionContext) {
commentDecoration();
vscode.window.onDidChangeActiveTextEditor(() => {
commentDecoration();
});
vscode.workspace.onDidChangeTextDocument(
@estruyf
estruyf / frontmatter.json
Created December 8, 2023 08:18
Front Matter CMS configuration for Bubblegum Theme
{
"$schema": "https://beta.frontmatter.codes/frontmatter.schema.json",
"frontMatter.taxonomy.contentTypes": [
{
"name": "project",
"pageBundle": false,
"filePrefix": null,
"fields": [
{
"title": "title",
@estruyf
estruyf / app-customizer-navigation-checks.ts
Created June 19, 2019 08:26
Application Customizer navigation checks
interface NavigationEventDetails extends Window {
isNavigatedEventSubscribed: boolean;
currentPage: string;
currentHubSiteId: string;
currentUICultureName: string;
}
declare const window: NavigationEventDetails;
export default class NavigationApplicationCustomizer extends BaseApplicationCustomizer<INavigationApplicationCustomizerProperties> {
@estruyf
estruyf / vscode-theme-variables.css
Created January 28, 2022 13:21
All VS Code theme variables
:root {
--vscode-font-weight:normal;
--vscode-font-size:13px;
--vscode-editor-font-family:&quot;Operator Mono Lig&quot;, &quot;Cascadia Code&quot;;
--vscode-editor-font-weight:normal;
--vscode-editor-font-size:15px;
--vscode-foreground:#f3eff5;
--vscode-errorForeground:#f48771;
--vscode-descriptionForeground:rgba(243, 239, 245, 0.7);
--vscode-icon-foreground:#c5c5c5;
@estruyf
estruyf / ListViewCommandCommandSet.ts
Created July 2, 2017 12:50
SharePoint Framework ListView Command Set Extension - get selected items
@override
public onExecute(event: IListViewCommandSetExecuteEventParameters): void {
switch (event.commandId) {
case 'COMMAND_1':
// Check if the user selected some items
if (event.selectedRows.length > 0) {
// Check the selected rows
event.selectedRows.forEach((row: RowAccessor, index: number) => {
alert(`Field ID: ${row.getValueByName('ID')} - Field title: ${row.getValueByName('Title')}`);
});
@estruyf
estruyf / 1-frontmatter-contenttype.json
Last active March 2, 2023 21:14
Front Matter - Open Graph
"frontMatter.taxonomy.contentTypes": [{
"name": "default",
"pageBundle": false,
"filePrefix": "yyyy-MM-dd",
"fields": [{
"title": "Title",
"name": "title",
"type": "string",
"required": true
},
@estruyf
estruyf / fm.snippets.json
Created June 9, 2022 18:29
Front Matter - Snippets
{
"frontMatter.content.snippets": {
"Image snippet": {
"body": "{{< caption-new \"[[&mediaUrl]]\" \"[[caption]]\" >}}",
"isMediaSnippet": true,
"description": ""
},
"Video snippet": {
"body": [
"{{< video \"[[&mediaUrl]]\" \"[[caption]]\" >}}"
@estruyf
estruyf / gulpfile.js
Last active October 15, 2020 10:31
SPFx deployment automation
'use strict';
const gulp = require('gulp');
const build = require('@microsoft/sp-build-web');
const spsync = require('gulp-spsync-creds').sync;
const sppkgDeploy = require('node-sppkg-deploy');
const fs = require('fs');
const environmentInfo = {
"username": "<production-username>",
@estruyf
estruyf / Retrieve list name via REST.js
Last active August 1, 2020 04:50
Retrieve the list name in a display template
Type.registerNamespace('search.listname');
search.listname = function () {
var itemInfo = {};
var listInfo = {};
var init = function (context, elmId) {
// Store item info
itemInfo[elmId] = {};
itemInfo[elmId]["webUrl"] = context.CurrentItem.SPWebURL;