Skip to content

Instantly share code, notes, and snippets.

View davehax's full-sized avatar

Davehax davehax

View GitHub Profile
/**
* Minimal Pub/Sub class
*
* @class EventEngine
*/
class EventEngine {
/**
* Creates an instance of EventEngine.
* @memberof EventEngine
*/
// Modern method
// If you need to polyfill, see this MDN article https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from
var args = Array.from(arguments);
// Old school method
var args = [].slice.call(arguments);
@jonlabelle
jonlabelle / npm_vs_yarn_command_translation_cheatsheet.md
Last active March 11, 2025 18:53
npm vs yarn command translation cheat sheet
@Aymkdn
Aymkdn / PeopleSearch_parameters.md
Last active June 1, 2020 23:22
Create a Sharepoint 2013 native People Picker in JavaScript (using jQuery, or using SharepointPlus)

Details about some of the options.

SearchPrincipalSource

The principal sources to search.

  • All (15) – Search all principal sources.
  • MembershipProvider (4) – Search the current membership provider.
  • None (0) – Search no principal sources.
  • RoleProvider (8) – Search the current role provider.
  • UserInfoList (1) – Search the user information list.
@vgrem
vgrem / SPBatchRequest.js
Last active July 13, 2023 17:31
Example: how to execute SharePoint REST Batch request
var jsonSPHeaders = {
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose",
"DataServiceVersion": "3.0"
};
OData.request( {
requestUri: _spPageContextInfo.webAbsoluteUrl + "/_api/$batch",
method: "POST",
headers: { "X-RequestDigest": $("#__REQUESTDIGEST").val(),
@khromov
khromov / bootstrap-3-grid.css
Last active June 12, 2017 16:05
Bootstrap 3 Grid (Without the rest of the framework).
/*!
* Grid portion of Bootstrap under sc- namespace.
* Classes:
* sc-container-fluid, sc-row, sc-col-X-Y (like regular B3)
*
* For more info, see:
* http://snippets.khromov.se/decoupled-bootstrap-3-grid/
*
* Bootstrap v3.2.0 (http://getbootstrap.com)
* Copyright 2011-2014 Twitter, Inc.
@cuth
cuth / serve.js
Created April 14, 2014 17:21
Run a local express server on the current directory's static files using node
var host = "127.0.0.1";
var port = 1337;
var express = require("express");
var app = express();
app.use('/', express.static(__dirname + '/'));
app.listen(port, host);
console.log('Running server at http://localhost:' + port + '/');
@chrisobriensp
chrisobriensp / AddRemoteEventReceiver.ps1
Last active June 13, 2023 15:17
PowerShell/CSOM to add a Remote Event Receiver to a SharePoint list
. .\TopOfScript_PSCSOM.ps1
function addListItemRemoteEventReceiver([Microsoft.SharePoint.Client.ClientContext]$context, [string]$listName,
[Microsoft.SharePoint.Client.EventReceiverType]$eventType, [Microsoft.SharePoint.Client.EventReceiverSynchronization]$synchronization,
[string]$receiverName, [string]$receiverUrl, [string]$receiverAssemblyName, [string]$receiverClassName)
{
$list = $context.Web.Lists.GetByTitle($listName);
$context.Load($list)
$eventReceivers = $list.EventReceivers
$context.Load($eventReceivers)
@MartinBodocky
MartinBodocky / gist:7984439
Last active March 10, 2020 17:50
Get Calendar recurrent events by CSOM from SharePoint 2013.
GetItemsFromCalendarAsmx = function (webUrl, calendarGuid) {
wsURL = webUrl + "_vti_bin/Lists.asmx";
var xmlCall =
"<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> <soap:Body>" +
"<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>" +
"<listName>" + calendarGuid + "</listName>" +
"<query>" +
"<Query>" +
@badmotorfinger
badmotorfinger / psmo.ps1
Last active February 12, 2024 00:18
Generates scripts for most SQL Server database objects using PowerShell (SMO objects)
################################################################################################################################
#
# Script Name : SmoDb
# Version : 1.0
# Author : Vince Panuccio
# Purpose :
# This script generates one SQL script per database object including Stored Procedures,Tables,Views,
# User Defined Functions and User Defined Table Types. Useful for versionining a databsae in a CVS.
#
# Usage :