Skip to content

Instantly share code, notes, and snippets.

View emiliano-poggi's full-sized avatar
🤩
Shining

Emiliano Poggi emiliano-poggi

🤩
Shining
View GitHub Profile
@emiliano-poggi
emiliano-poggi / function-v2.ps1
Last active August 29, 2015 14:04
Template for Powershell functions
function <name>
{
<#
.SYNOPSIS
The synopsis goes here. This can be one line, or many.
.DESCRIPTION
The description is usually a longer, more detailed explanation of what the script or function does. Take as many lines as you need.
.PARAMETER computername
@emiliano-poggi
emiliano-poggi / 0.md
Last active August 29, 2015 14:15
SharePoint 2013 How To XSL Link Option List View Web Part

SharePoint 2013 How To XSL Link Option List View Web Part

XSL Link option allows to link an XSLT stylesheet uploaded to the site for processing and transforming List View data to which the web part is connetcted.

The input xml passed to XSLT is described here https://msdn.microsoft.com/en-us/library/office/ff602042(v=office.14).aspx

There are two main ways to work:

  • Just transform input data and render it as wanted
  • Include the default templates and override those as required
@emiliano-poggi
emiliano-poggi / 0.md
Last active August 29, 2015 14:15
SharePoint 2013 Visual Studio Team Foundation Web Parts How To Automatically Refresh Query Results Without Postback Action

SharePoint 2013 Visual Studio Team Foundation Web Parts How To Automatically Refresh Query Results Without Postback Action

You want to refresh the Query Results web parts of Visual Studio Team Foundtion embedded into a web part page, so that every 3 seconds the user has a query updated without having to refresh the entire page. Obviously you want automatically refresh the single web part, not the entire web page.

  1. In Edit mode, search in the web page runtime elements for the keyword "Refresh Results". You should find one or more ie:menuitem elements, many elements as many Query Results web parts you have. See the snippet_menuitem.html below for an example.
  2. The script you are interested to is in the onmenuclick attribute.
  3. After you have taken note of all required onmenuclick values just build you refresher as shown below.
#!/bin/bash
echo hello gists!
@emiliano-poggi
emiliano-poggi / get-script-path.ps1
Created March 31, 2011 16:16
POSH: Get the current script abosulte path
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
@emiliano-poggi
emiliano-poggi / delete-duplicate-record.sql
Created April 1, 2011 20:27
SQL: Delete duplicate records from a table
use ITBICDB
go
alter table datastoresinfo add ID int identity(1,1)
go
delete from datastoresinfo
where ID not in
(
select MAX(ID)
@emiliano-poggi
emiliano-poggi / rename-file2.ps1
Created April 2, 2011 20:50
POSH: Rename files
# rename files matching a pattern
ls c:\folder_path | ? {$_.name -match 'vol._'} |
rename-item -newname {$_.name -replace 'vol._','vol.'}
@emiliano-poggi
emiliano-poggi / change-file-ext.ps1
Created April 3, 2011 20:45
POSH: Change file extension
ls *.ps1 |
% { Rename-Item $_.Name ([System.IO.Path]::GetFileNameWithoutExtension($_.FullName) + `
".bak")
@emiliano-poggi
emiliano-poggi / copy-files.ps1
Created April 3, 2011 20:57
POSH: Copy all files of a specific file extension to the desktop
Copy-Item $home\*.ps1 ([Environment]::GetFolderPath("Desktop"))
@emiliano-poggi
emiliano-poggi / foreach-ext.ps1
Created April 4, 2011 21:45
POSH: Foreach construct extended syntax
# explicit full foreach
ls -filter $home\bin\*.ps1 | foreach -begin {get-date} `
-process {$_.length/1024} `
-end {get-date}
# shortest full foreach
ls -filter $home\bin\*.ps1 | % {get-date} `
{$_.length/1024} `
{get-date}