Skip to content

Instantly share code, notes, and snippets.

View wictorwilen's full-sized avatar
😀

Wictor Wilén wictorwilen

😀
View GitHub Profile
@wictorwilen
wictorwilen / powerline_prompt_ww.lua
Created February 28, 2018 16:45
cmder custom prompt with git and npm support
-- Source: https://github.com/AmrEldib/cmder-powerline-prompt
--- promptValue is whether the displayed prompt is the full path or only the folder name
-- Use:
-- "full" for full path like C:\Windows\System32
local promptValueFull = "full"
-- "folder" for folder name only like System32
local promptValueFolder = "folder"
-- default is promptValueFull
local promptValue = promptValueFull
@wictorwilen
wictorwilen / wutrouble.ps1
Created August 27, 2017 19:00
Windows Update troubleshooter
## https://support.microsoft.com/en-us/help/971058/how-do-i-reset-windows-update-components
cleanmgr /sageset
cleanmgr /sagerun
$path = "c:\windows\SoftwareDistribution"
@wictorwilen
wictorwilen / extractTextFromMessage.ts
Created June 5, 2017 06:29
Scrub @ mentions in Microsoft Teams
private static extractTextFromMessage(message: builder.IMessage): string {
var s = (message.text) ? message.text : '';
if (message.entities) {
message.entities.forEach((ent: any) => {
s = s.replace(ent.text, '');
})
}
return s.trim();
}
@wictorwilen
wictorwilen / RemoveCustomAction.js
Created July 15, 2015 12:56
Remove Custom Action with JSOM
var context = SP.ClientContext.get_current()
var web = context.get_web()
var actions = web.get_userCustomActions();
context.load(web)
context.load(actions)
context.executeQueryAsync(
function () {
var newAction = actions.add();
@wictorwilen
wictorwilen / office365groupscreation.ps1
Last active January 26, 2017 08:43
Office 365 Groups Creation
# For more information see: http://askwictor.com/2jxcYDT
# Store the credentials in a variable
$creds = Get-Credential
# Connect to the Microsoft Online services
Connect-MsolService -Credential $creds
# Get tenant setting (misspelled)
Get-MsolCompanyInformation | Format-List UsersPermissionToCreateGroupsEnabled
@wictorwilen
wictorwilen / config.json
Created October 31, 2016 08:00
JavaScript only client-side Web Part (SPFX)
{
"entries": [
{
"entry": "./lib/webparts/manual/manual.js",
"manifest": "./src/webparts/manual/manual.manifest.json",
"outputPath": "./dist/manual.bundle.js"
}
],
"externals": {
"@microsoft/sp-client-base": "node_modules/@microsoft/sp-client-base/dist/sp-client-base.js",
@wictorwilen
wictorwilen / officeroadmap-bloghelper.ps1
Created August 1, 2016 06:29
Office 365 Roadmap site script
## Import a diff file
$d = Import-Clixml .\diff2016-05-20.xml
## Write some Html stuff
$d | ?{$_.SideIndicator -eq "=>"} | % {
Write-Host "<li><b>$($_.outerText):</b> </li>"
}
@wictorwilen
wictorwilen / dummy.cs
Created September 30, 2015 13:36
SPO Create Site
SpoOperation op = _tenant.CreateSite(_newsite);
ctx.Load(_tenant);
ctx.Load(op, i => i.IsComplete);
try {
ctx.ExecuteQuery();
}
catch (ServerException se)
{
if(se.ServerErrorCode != -2146233083)
@wictorwilen
wictorwilen / GetPageProperties.js
Created July 17, 2015 08:58
Get Page Properties using JSOM
var context = SP.ClientContext.get_current();
var web = context.get_web();
var currentList = web.get_lists().getById(_spPageContextInfo.pageListId);
var currentListItem = currentList.getItemById(_spPageContextInfo.pageItemId);
context.load(currentListItem);
context.executeQueryAsync(
function(){
console.log('Success')
console.log(currentListItem)
console.log(currentListItem.get_item('PropertyName'))
@wictorwilen
wictorwilen / AddCustomAction.js
Created July 15, 2015 12:56
Add Custom Action using JSOM
var context = SP.ClientContext.get_current()
var web = context.get_web()
var actions = web.get_userCustomActions();
context.load(web)
context.load(actions)
context.executeQueryAsync(
function () {
var newAction = actions.add();