Skip to content

Instantly share code, notes, and snippets.

@mirontoli
mirontoli / jquery.widget.flydown.js
Last active December 17, 2015 04:49
A flyout menu widget for jQuery UI like in Facebook. I call it flydown
/***************************************************
jQuery UI Flyout widget like in Facebook
******************************************************/
(function($, undefined) {
$.widget("ui.flydowns", {
///<summary>This is a custom jQuery widget
///for flydowns (flyout dropdowns)
///usage: $("your_selector").flydowns();
///</summary>
_create: function() {
@mirontoli
mirontoli / likescount.js
Last active December 18, 2015 16:08
Shows a count of likes where you can like or unlike a SharePoint Page
"use strict";
window.tolle = window.tolle || {};
tolle.utils = tolle.utils || {};
tolle.utils.renderLike = (function() {
var like = { item: undefined, container: undefined};
var onSuccess = function() {
var count = like.item.get_item("LikesCount") == null ? "0" : String(like.item.get_item("LikesCount"));
var likerLookupItems = like.item.get_item("LikedBy");
var likers = [];
if (likerLookupItems != null) {
@mirontoli
mirontoli / ChocoScript.ps1
Last active June 14, 2016 04:37
This script install the development tools I need in a Windows Server with SharePoint. Chocolatey: http://chocolatey.org/It must be run in cmd
# Install Chocolatey
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
# Install Tools
# choco install ulsviewer &
choco install GoogleChrome -y
choco install vim -y
choco install SharePointDesigner2013x64 -y
choco install ilspy -y
choco install fiddler4 -y
@mirontoli
mirontoli / AddLinksToCA.ps1
Created August 14, 2013 20:55
Add links into a Top Navigation Bar in SharePoint Central Admin
#Add links into a Top Navigation Bar in SharePoint Central Admin
if(-not(gsnp | ? { $_.Name -eq "Microsoft.SharePoint.PowerShell"})) { asnp Microsoft.SharePoint.PowerShell }
$url = "http://dev:2013"
$web = Get-SPWeb $url
$links = @{
"Farm Solutions" = "/_admin/Solutions.aspx"
"Service Applications" = "/_admin/ServiceApplications.aspx"
"Site Collection Owners" = "/_admin/owners.aspx"
"UPA" = "/_layouts/15/ManageUserProfileServiceApplication.aspx?ApplicationID=c32b96b6%2D7c34%2D4113%2D9982%2Df4e47aad1e50"
"SSA" = "/searchadministration.aspx?appid=5f037fe9-0cde-4bbb-a3a0-30f2605a0220"
@mirontoli
mirontoli / HideTitle_ContentType.xml
Created August 21, 2013 21:05
Hiding the Title column in SharePoint. Taken the solution from @StackSharePoint: [Remove Title Field](http://sharepoint.stackexchange.com/questions/38219/cant-hide-the-title-column-in-a-custom-content-type/38340#38340) and adjusted so that the Title is just hidden, not removed. The trick is to write <Field> element twice, otherwise you won't see…
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Parent ContentType: Item (0x01) -->
<ContentType ID="0x010019DBC07DC85E425FAC393333BE5C537A"
Name="TolleCT"
Group="Tolle"
Description="My Content Type"
Inherits="FALSE" Version="0">
<FieldRefs>
<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" Hidden="TRUE" Required="FALSE" />
@mirontoli
mirontoli / resizeiframe.js
Created October 21, 2013 08:32
Resize IFrame
function ResizeIFrame(height, width) {
if (!window.parent)
return;
var senderId = decodeURIComponent(getQueryStringParameter("SenderId"));
var message = "<Message senderId=" + senderId + " >"
+ "resize(" + width + "," + height + ")</Message>";
parent.postMessage(message, '*');
}
@mirontoli
mirontoli / create-ps-profile.ps1
Last active November 17, 2016 19:26
PowerShell Profile: ~\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1http://sharepoint.stackexchange.com/questions/15102/automatically-add-pssnapin-microsoft-sharepoint-powershell
if (!(Test-Path $profile)) {
New-Item $profile -Type File -Force
}
@mirontoli
mirontoli / poedit-translation-cv.po
Created January 18, 2014 16:50
PoEdit Chuvash original file from 2008-01-26
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2008-01-26 23:14+0100\n"
"Last-Translator: mirontoli <mirontoli@gmail.com>\n"
"Language-Team: Chuvash Soft <mirontoli@gmail.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
@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