Skip to content

Instantly share code, notes, and snippets.

View gitbrent's full-sized avatar
SPFx + PnP + React = Great SPO Apps!

Brent Ely gitbrent

SPFx + PnP + React = Great SPO Apps!
View GitHub Profile
@yangshun
yangshun / docusaurus-copy-button.md
Last active April 4, 2023 07:07
How to add the "Copy" button to code blocks in Docusaurus

Adding "Copy" (to Clipboard) Button

If you would like to add a button to your fenced code blocks so that users may copy the code, you can do so in Docusaurus. You will have to add some code to your Docusaurus project, as seen below.

Under static/js, create a file called code-block-buttons.js with the following:

// Turn off ESLint for this file because it's sent down to users as-is.
/* eslint-disable */
window.addEventListener('load', function() {
@newyankeecodeshop
newyankeecodeshop / ServingES6.md
Last active June 19, 2021 07:36
Serving ES6 to modern browsers

Background

Recently I noticed that Safari 10 for Mac/iOS had achieved 100% support for ES6. With that in mind, I began to look at the browser landscape and see how thorough the support in the other browsers. Also, how does that compare to Babel and its core-js runtime. According to an ES6 compatability table, Chrome, Firefox, and IE Edge have all surpassed what the Babel transpiler can generate in conjunction with runtime polyfills. The Babel/core-js combination achieves 71% support for ES6, which is quite a bit lower than the latest browsers provide.

It made me ask the question, "Do we need to run the babel es2015 preset anymore?", at least if our target audience is using Chrome, Firefox, or Safari.

It's clear that, for now, we can't create a site or application that only serves ES6. That will exclude users of Internet Explorer and various older browsers running on older iOS and Android devices. For example, Safari on iOS 9 has pretty mediocre ES6 support.

@andrewconnell
andrewconnell / spAppUtils.js
Created October 22, 2013 13:36
SharePoint REST script library for obtaining common paths in client-side SharePoint 2013 development.
(function() {
var module = {
getAppAbsoluteUrl: getAppAbsoluteUrl,
getAppRelativeUrl: getAppRelativeUrl,
getAppODataApiUrl: getAppODataApiUrl
};
return module;
function getAppAbsoluteUrl() {
return _spPageContextInfo.webAbsoluteUrl;
@RainerAtSpirit
RainerAtSpirit / api.js
Created October 8, 2012 10:41
Odata v3: SharePoint 2013 _api $metadata conversion
////////////////////////////////////////////////////////////////////////////////////////
////// Autogenerated by JaySvcUtil.exe http://JayData.org for more info /////////
////// oData v3 /////////
////////////////////////////////////////////////////////////////////////////////////////
(function(global, $data, undefined) {