Skip to content

Instantly share code, notes, and snippets.

@iOnline247
iOnline247 / storage-wrapper.js
Last active June 21, 2016 19:53
Local/Sessionstorage wrapper
(function(window) {
function isFunction (func) {
return typeof func === 'function';
}
function isStorageEnabled () {
const str = 'test';
try {
this.store.setItem(str, str);
this.store.removeItem(str);
@iOnline247
iOnline247 / downloadAllYammerFiles.js
Last active June 21, 2016 13:20 — forked from PCfromDC/downloadAllYammerFiles.js
Download All Yammer Files
function getDownloadLink(el, i) {
'use strict';
var rlastForwardSlash = /.+\//,
fileId = (el.href) ? el.href.replace(rlastForwardSlash, '') : '',
downloadPath = 'https://www.yammer.com/api/v1/uploaded_files/' + fileId + '/download'
;
return downloadPath;
}
function downloadFile(dataUrl) {
'use strict';
@iOnline247
iOnline247 / add-new.xml
Created May 19, 2016 19:44
XSL Template to add new button
<xsl:output method="html" indent="no"/>
<xsl:decimal-format NaN=""/>
<xsl:param name="dvt_apos">'</xsl:param>
<!-- Define the HttpVDir variable -->
<xsl:param name="HttpVDir"/>
<!--
Usage: <xsl:call-template name="addnew" />
-->
<xsl:template name="addnew">
@iOnline247
iOnline247 / flatten.js
Created April 27, 2016 16:08 — forked from thetutlage/flatten.js
Flatten an array in Javascript without recursion
'use strict'
var Benchmark = require('benchmark')
var suite = new Benchmark.Suite;
var list = [1, 2, 3, [[4]], [[[5]]], [6], [[7]]]
function flattenRecursive (list) {
var flatList = []
list.forEach(function (item) {
@iOnline247
iOnline247 / FileNameLengthCheck.ps1
Created March 25, 2016 15:23
Generates a report on files within a directory.
# https://www.petri.com/powershell-problem-solver-finding-long-file-names
$folderPath = "\\servername\c$\folderPath"
$csvPath = "C:\fileLengthCheck.csv"
dir -LiteralPath $folderPath -File -Recurse -Force |
Select Directory,Name,@{Name="NameLength";Expression={$_.name.length}} |
Where {$_.NameLength -ge 45} |
Export-Csv -LiteralPath $csvPath -Force -NoTypeInformation
@iOnline247
iOnline247 / $sp.ca.js
Last active May 12, 2023 13:01
Create/Delete Custom Actions in SharePoint
/*!
* Created by Matthew Bramer :: @iOnline247
* Released under the MIT license
* Date: 2016-02-12 v1
* Inspired from script written on: 2014-05-17
* https://dl.dropboxusercontent.com/u/21583725/demos/SPSDC-ModalMania/demo/js/iframeDemo.js
* Tested using SharePoint Online.
*
* Helpful Links
* https://msdn.microsoft.com/en-us/library/office/dn531432.aspx#bk_UserCustomActionRequestExamples
@iOnline247
iOnline247 / $sp.wf.js
Last active March 20, 2019 19:16
Use this to fire list workflows by name or subscriptionId.
/*!
* Created by Matthew Bramer
* Released under the MIT license
* Date: 2015-04-18
* Props to: http://plumsail.com/blog/2015/02/start-sharepoint-2013-workflows-selected-items/
* Tested using SharePoint Online.
* On-Prem still needs testing.
*/
window.$sp = window.$sp || {};
@iOnline247
iOnline247 / Create-Files-Folders.ps1
Created March 28, 2015 18:18
Create 21,000 folders and 21,000 files for funsies
# Create 21,000 folders and 21,000 txt files.
# Add one file per folder.
# Folder names will be sequential.
# File names will start with a GUID and end with a timestamp.
# This is to try and prove if ODB is FIFO and not any other way.
param(
[parameter(mandatory=$true)]
[string]$filePath
)
var $1_10_2 = jQuery.noConflict();
(function( $, undefined ) {
var results = []
;
retrieveListItems();
function retrieveListItems() {
var cachedItems = JSON.parse(localStorage.getItem("pl-Vendors"));
jQuery.ajax({
type: "GET",
url: "/sites/siteName/_vti_bin/ExcelRest.aspx/listName/Vendors.xlsx/OData/Table1?$inlinecount=allpages",
headers: {
"Accept": "application/json;odata=verbose",
"X-RequestDigest": __REQUESTDIGEST.value
}
})
.done(function(data, status) {
console.dir(data);