Skip to content

Instantly share code, notes, and snippets.

@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 / 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",

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"
@iOnline247
iOnline247 / SPServices.StartWorkflow
Created February 19, 2014 19:02
SPServices.StartWorkflow
$.fn.SPServices.StartWorkflow = function(options) {
var opt = $.extend({}, {
itemUrl: null,
workflowName: null,
workflowParameters: "<root />",
completefunc: null, // Function to call on completion of rendering the change.
debug: false // If true, show error messages;if false, run silent
}, options),
thisFunction = "SPServices.StartWorkflow",
@iOnline247
iOnline247 / bookmarklet-change-user.js
Created April 28, 2017 15:37
Prompts user to login to a SharePoint site
javascript:(function(a){a.location.href=("undefined"!=typeof _spPageContextInfo?_spPageContextInfo.webAbsoluteUrl:a.location.origin+L_Menu_BaseUrl)+"/_layouts/closeConnection.aspx?loginasanotheruser=true"}(window));
Write-Host ((0..56)|%{if (($_+1)%3 -eq 0){[char][int]("114101109121109097122097064103109097105108046099111109"[($_-2)..$_] -join "")}}) -separator ""
@iOnline247
iOnline247 / Create-ADUsers.ps1
Created November 29, 2017 05:34
SP2016 Installation Scripts
$pathToOU = 'OU=SP Accounts,DC=fahq,DC=local'
$password = ConvertTo-SecureString "P@ssw0rd" -AsPlainText -Force
New-ADUser -SamAccountName "sp_wf" -Name "sp_wf" -DisplayName "sp_wf" -Path $pathToOU -Enabled $true -AccountPassword $password -ChangePasswordAtLogon $false -PasswordNeverExpires $true
@iOnline247
iOnline247 / register-dependencies.unmin.js
Created January 15, 2018 18:02
SharePoint SP.SOD Helper
;(function() {
// Is MDS enabled?
if ("undefined" != typeof g_MinimalDownload && g_MinimalDownload && (window.location.pathname.toLowerCase()).endsWith("/_layouts/15/start.aspx") && "undefined" != typeof asyncDeltaManager) {
// Register script for MDS if possible
RegisterModuleInit("init.js", init); //MDS registration
init(); //non MDS run
} else {
init();
}