Skip to content

Instantly share code, notes, and snippets.

@mirontoli
mirontoli / search-lang-sp.js
Created February 2, 2014 10:30
This is a workaround for search center refinements in SharePoint 2013. The bug is that the search center takes the browser language, instead of the default language of the SharePoint farm.
//This is a workaround for search language. Please remove this after the August Patch has been installed (SharePoint 2013, 2013 CU)
//A control for changing the language adds a url fragment: #l=1033 (for English)
// bug #2319
(function() {
var href = window.location.href;
var url = window._tpContextInfo.SearchCenterUrl;
var searchCenter = href.indexOf(url + "/results.aspx") === 0 || href.indexOf(url + "/peopleresults.aspx") === 0;
if (searchCenter) {
var hash = window.location.hash;
var langRegexPattern = "#l=\\d{4}";
function Minify {
<#
.Synopsis
Short description
.DESCRIPTION
Long description
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
@mirontoli
mirontoli / CsvToXml_anatoly.ps1
Last active August 29, 2015 14:01
Create an xml file from CSV
function New-Location {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
[string]$Title,
[Parameter(Mandatory=$true)]
[int]$Level,
[Parameter(Mandatory=$false)]
[PSObject]$Parent = $null
)

Today an interesting conversation arose on Twitter between me and Hugh Wood about _spBodyOnLoadFunctions.push. I tested the _spBodyOnLoadFunctions vs jQuery(document).ready and $(window).load. Here are the results:

  • _jQuery document.ready. Time: 54 default-empty.aspx:495
  • _spBodyOnLoadFunctions. Time: 337 default-empty.aspx:493
  • jQuery window load. Time: 459

alt text

var prices = { x:15, y: 1, z: 0.25 };
var combinations = [];
for (var x = 1; x < 99; x++) {
for (var y = 1; y < 99; y++) {
var z = 100 - x - y;
if (z > 0) {
combinations.push({x:x,y:y,z:z});
}
}
}
@mirontoli
mirontoli / head.md
Last active August 29, 2015 14:02 — forked from joladev/katze.clj

ekvation 1:

15h + k + 0,25m = 100 (1)

multiplicerad med 4 för att få heltal:

60h + 4k + m = 400 (1)

ekvation 2:

The file has been moved to Github.

#existing stuff, do not copy:
$url = "https://some.contoso.com"
asnp *share*
#remove all webparts
$step = "Deleting Existing Webparts"
$pageUrl = $url + "/Pages/default.aspx"
$site = new-object microsoft.sharepoint.spsite $pageUrl
function Export-WebPart {
<#
.Synopsis
Short description
.DESCRIPTION
Does not work, it redirects
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
#!/usr/bin/env ruby
target = "METHINKS IT IS LIKE A WEASEL"
@gene_pool = ("A".."Z").to_a << " "
litter_size = 100
mutation_rate = 0.04
def rand_gene
@random = rand(@gene_pool.count)
@gene_pool.at( @random )