Skip to content

Instantly share code, notes, and snippets.

@wpsmith
wpsmith / browser-language-codes.js
Last active July 24, 2024 06:26
JS: Object of Browser Language Codes
// <![CDATA[
var langCodes = {
"af": "Afrikaans",
"sq": "Albanian",
"an": "Aragonese",
"ar": "Arabic (Standard)",
"ar-dz": "Arabic (Algeria)",
"ar-bh": "Arabic (Bahrain)",
"ar-eg": "Arabic (Egypt)",
"ar-iq": "Arabic (Iraq)",
@wpsmith
wpsmith / Export-SpSearchManagedProperties.ps1
Created April 2, 2015 16:29
PowerShell - This script will export Managed and Crawled Properties from SharePoint 2010 Enterprise Search. I have used this during our migration to FAST Enterprise Search.
#------------------------------------------------------------------------------------------------------
# Name: Export-SpSearchManagedProperties.ps1
# Description: This script will export create Crawled and Managed Properties from Enterprise Search
#
# Usage: Run the function with a required parameters
# By: Ivan Josipovic, Softlanding.ca
#------------------------------------------------------------------------------------------------------
Function Export-SpSearchManagedProperties([string]$SearchServiceApp,[string]$filename){
#Use This to ignore the out of the box managed properties
$IgnoreMappings = @("AboutMe","Account","AccountName","AssignedTo","Author","BaseOfficeLocation","BestBetKeywords","CategoryNavigationUrl","CollapsingStatus","Colleagues","contentclass","ContentsHidden","ContentSource","ContentType","CreatedBy","Department","Description","DisplayDate","DocComments","DocId","DocKeywords","DocSignature","DocSubject","DuplicateHash","EMail",
@wpsmith
wpsmith / adobe-licenses.vbs
Last active July 7, 2024 17:37
VBS: Get All Adobe License Keys
'Modified by Travis Smith (wpsmith.net) to fetch all Adobe licenses.
'Written by Ryan Williams (ryan@ryadical.com), I am not a programmer so please excuse the messy code
'Now to give credit where credit is due:
'Cipher code converted from Sam Gleske's javascript found at: http://www.pages.drexel.edu/~sag47/adobe/
'His code was Converted from the source for "Enchanted Keyfinder"
'original algorithm by Dave Hope (http://www.davehope.co.uk)
'To run this program make sure that sqlite3.exe is in the same folder as this vbs file.
'SQLITE3 source and binaries can be found at www.sqlite.org
@wpsmith
wpsmith / get-cookie.js
Created July 5, 2015 21:50
JavaScript: Get Cookie By Name
@wpsmith
wpsmith / font-mimetypes
Last active April 25, 2024 00:44 — forked from localpcguy/font-mimetypes
Mime Types for .htaccess or web.config
.eot - application/vnd.ms-fontobject
.woff - application/font-woff
.ttf - application/x-font-truetype
.svg - image/svg+xml
.otf - application/x-font-opentype
IIS (Web.Config)
<remove fileExtension=".eot" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<remove fileExtension=".ttf" />
@wpsmith
wpsmith / Microsoft.PowerShell_profile.ps1
Created July 15, 2015 13:17
PowerShell: Profile to always launch PS as Administrator, set Aliases (ex. Notepad++), Import SharePoint Online, Azure AD, and Azure Services.
# Check if Running as Admin
$IsAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
if (-not $IsAdmin)
{
if ($MyInvocation.ScriptName -ne "")
{
try
{
Write-Host "Relanuching Script as Admin"
@wpsmith
wpsmith / sanitize_phone.php
Created June 5, 2014 17:00
PHP: Sanitize & Format US Phone Numbers
<?php
function sanitize_phone( $phone, $international = false ) {
$format = "/(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$/";
$alt_format = '/^(\+\s*)?((0{0,2}1{1,3}[^\d]+)?\(?\s*([2-9][0-9]{2})\s*[^\d]?\s*([2-9][0-9]{2})\s*[^\d]?\s*([\d]{4})){1}(\s*([[:alpha:]#][^\d]*\d.*))?$/';
// Trim & Clean extension
$phone = trim( $phone );
$phone = preg_replace( '/\s+(#|x|ext(ension)?)\.?:?\s*(\d+)/', ' ext \3', $phone );
@wpsmith
wpsmith / Get-AvailableExceptionsList.ps1
Created April 16, 2015 14:09
PowerShell: Retrieves all available Exceptions to construct ErrorRecord objects.
<#
.Synopsis
Retrieves all available Exceptions to construct ErrorRecord objects.
.Description
Retrieves all available Exceptions in the current session to construct ErrorRecord objects.
.Example
$availableExceptions = Get-AvailableExceptionsList
@wpsmith
wpsmith / New-ErrorRecord.ps1
Created April 16, 2015 14:16
PowerShell: Creates an custom ErrorRecord that can be used to report a terminating or non-terminating error.
<#
.Synopsis
Creates an custom ErrorRecord that can be used to report a terminating or non-terminating error.
.Description
Creates an custom ErrorRecord that can be used to report a terminating or non-terminating error.
.Parameter Exception
The Exception that will be associated with the ErrorRecord.
@wpsmith
wpsmith / Repair-SPDistributedCache.ps1
Last active May 17, 2023 08:53
PowerShell: Repair SharePoint Distributed Cache Service Instance
<#
.Synopsis
Repairs the Distributed Cache on a Server.
.Description
Repairs the Distributed Cache on a Server by removing the current Distributed Cache Service instance.
.Parameter Server ("ServerName")
The Server running Distributed Cache Service
Type: String