Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / $sp-no-jquery.js
Last active March 10, 2021 21:03
Wrapper for SharePoint REST API.
/*!
* Created by Matthew Bramer
* Released under the MIT license
* Date: 2016-07-11
* Props to: http://blogs.msmvps.com/windsor/2015/02/13/reduce-code-need-for-rest-api-calls-with-sprestrepository/
* Tested using SharePoint Online & 2013 On-Prem.
*/
// http://sharepoint.stackexchange.com/questions/74978/can-i-tell-what-version-of-sharepoint-is-being-used-from-javascript
@iOnline247
iOnline247 / package.json
Created July 12, 2016 21:50 — forked from addyosmani/package.json
npm run-scripts boilerplate
{
"name": "my-app",
"version": "1.0.0",
"description": "My test app",
"main": "src/js/index.js",
"scripts": {
"jshint:dist": "jshint src/js/*.js'",
"jshint": "npm run jshint:dist",
"jscs": "jscs src/*.js",
"browserify": "browserify -s Validating -o ./dist/js/build.js ./lib/index.js",
@iOnline247
iOnline247 / configlist.unmin.js
Last active March 11, 2021 13:01
Create a bulletproof configuration list for custom SharePoint apps.
/*!
* Created by Matthew Bramer
* Released under the MIT license
* Date: 2016-08-05
* Tested using SharePoint Online.
*/
// Get $sp.min.js from here.
// https://gist.github.com/iOnline247/cc8d68cb611b056695434224e6c2aa19
import '../vendor/$sp.min';

ServiceWorker for github pages

This is a ServiceWorker template to turn small github pages into offline ready app.

Why ?

Whenever I make small tools & toys, I create github repo and make a demo page using github pages (like this one).
Often these "apps" are just an index.html file with all the nessesary CSS and JavaScript in it (or maybe 2-3 html/css/js files). I wanted to cache these files so that I can access my tools offline as well.

Notes

Make sure your github pages have HTTPS enforced, you can check Settings > GitHub Pages > Enforce HTTPS of your repository.

@iOnline247
iOnline247 / AppOnly-ACS-PowerShell-Sample.ps1
Created January 11, 2017 03:53 — forked from wictorwilen/AppOnly-ACS-PowerShell-Sample.ps1
SharePoint Online: App Only policy PowerShell tasks with ACS
# For more information see: http://www.wictorwilen.se/sharepoint-online-app-only-policy-powershell-tasks-with-acs
$clientId = "<INSERT YOUR CLIENT ID HERE>"
$secret = "<INSERT YOUR CLIENT SECRET HERE>";
$redirecturi = "<INSERT YOUR REDIRECT URI HERE>"
$url = "https://<TENANT>.sharepoint.com/sites/contoso/"
$domain = "<TENANT>.sharepoint.com"
$identifier = "00000003-0000-0ff1-ce00-000000000000"