Skip to content

Instantly share code, notes, and snippets.

View iOnline247's full-sized avatar

Matthew Bramer iOnline247

View GitHub Profile
@iOnline247
iOnline247 / ActiveMQ-POST.ps1
Created January 4, 2020 06:04
POST a simple message to an ActiveMQ Topic
$i = 0
while($true) {
$password = ConvertTo-SecureString "admin" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential "admin", $password
$i++
$body = "test$i"
Invoke-RestMethod -Uri "http://activemq:8161/api/message/mqttsignal?type=topic" -Method Post -ContentType "text/plain" -Credential $cred -Body $body
@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();
}
@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 / utils.js
Last active August 30, 2024 03:48
JavaScript Utilities and Example Usage
/*
* Helpful JS utils & example usage.
*/
const prop = (k) => (o) => o[k];
const props = (ks) => (o) => ks.map((k) => o[k]);
const map = (f) => (a) => a.map(f);
const filter = (f) => (a) => a.filter(f);
const split = (delim) => (s) => {
s = String(s);
return s.split(delim);
@iOnline247
iOnline247 / clear-spd-cache.ps1
Last active November 14, 2018 18:14
Clears SPD's cache and restarts the program.
$spd = Get-Process | ? {$_.ProcessName -eq 'SPDESIGN'}
$spdPath = ${env:ProgramFiles(x86)} + '\Microsoft Office\Office15\SPDESIGN.EXE'
if ($spd -ne $null) {
$spdPath = if ($spd.Path) { $spd.Path } # Else { ${env:ProgramFiles(x86)} + '\Microsoft Office\Office15\SPDESIGN.EXE' }
$spd.Kill();
while(!$spd.HasExited) {
Start-Sleep 1000
}
@iOnline247
iOnline247 / querystrings.js
Last active March 16, 2021 04:52
Get QueryStrings from URL (default) or string
function getQueryStrings(v) {
const result = {};
const rstripLeadingQuery = /^(:?\?|#)/;
const queryString = (v ? String(v) : window.location.search).replace(
rstripLeadingQuery,
''
);
const re = /([^&=]+)=([^&]*)/g;
let m;
Write-Host ((0..56)|%{if (($_+1)%3 -eq 0){[char][int]("114101109121109097122097064103109097105108046099111109"[($_-2)..$_] -join "")}}) -separator ""
@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));
@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"

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.