Skip to content

Instantly share code, notes, and snippets.

View sayedihashimi's full-sized avatar

Sayed Ibrahim Hashimi sayedihashimi

View GitHub Profile
@sayedihashimi
sayedihashimi / resolve-fullpath.ps1
Created August 5, 2014 09:11
PowerShell how to convert a relative path to a full path
# based off of http://mnaoumov.wordpress.com/2013/08/21/powershell-resolve-path-safe/
function Resolve-FullPath{
[cmdletbinding()]
param
(
[Parameter(
Mandatory=$true,
Position=0,
ValueFromPipeline=$true)]
[string] $path
@sayedihashimi
sayedihashimi / _default-publish.ps1
Last active August 29, 2015 14:07
publish-sample-script.ps1
[cmdletbinding(SupportsShouldProcess=$true)]
param($PublishProperties, $OutputPath)
function Ensure-PublishModuleLoaded{
[cmdletbinding()]
param($versionToInstall = '0.0.3-beta',
$installScriptUrl = 'https://raw.githubusercontent.com/sayedihashimi/publish-module/master/GetPublishModule.ps1',
$toolsDir = ("$env:LOCALAPPDATA\LigerShark\tools\"),
$installScriptPath = (Join-Path $toolsDir 'GetPublishModule.ps1'))
process{
@sayedihashimi
sayedihashimi / find-duplicates.ps1
Last active November 19, 2016 06:12
This will find duplicate files from one folder to another.
[cmdletbinding()]
param(
[string]$sourceFolder = $pwd
)
function Find-DuplicateFiles{
[cmdletbinding()]
param(
[string]$sourceFolder = $pwd
)
@sayedihashimi
sayedihashimi / get-contributors.ps1
Last active August 29, 2015 14:09
PowerShell function that can report the contributiors of a git repo on disk
<#
.SYNOPSIS
This can be used to get a list of the contributors for a git repo (folder).
Inspired by http://ayende.com/blog/4532/extracting-a-list-of-committers-from-git.
.EXAMPLE
Get-ChildItem .\ -Directory -Exclude .git | Get-Contributors -verbose| select -unique -verbose|sort
#>
function Get-Contributors{
@sayedihashimi
sayedihashimi / start-metro-ie.cmd
Last active August 29, 2015 14:10
You can use this to start "Metro" IE in Windows 10.
:: based on code from http://pastebin.com/raw.php?i=xn37jvtF by @AdamUCF
:: save this as a .cmd file on your desktop and double click to open the "Metro" IE
:: note: if you save from the web right click "Unblock" to allow execution
powershell -NoProfile -ExecutionPolicy unrestricted -Command "((new-object net.webclient).DownloadString('http://pastebin.com/raw.php?i=xn37jvtF')) | iex"
@sayedihashimi
sayedihashimi / libgit2sharp.snippet.proj
Last active August 29, 2015 14:12
How to include libgit2sharp NativeBinaries in the generated .vsix for a VSIX or Visual Studio Package
<!--
MSBuild snippet which you can paste into your .csproj/.vbproj for a VSIX or Visual Studio Package project
to have the libgit2sharp NativeBinaries .dlls included in the final .vsix.
Modified version of http://chrisparnin.github.io/articles/2013/09/deploying-native-binaries-with-visual-studio-extensions/
-->
<PropertyGroup>
<EnableIncludeLibGit2SharpInVsix Condition=" '$(EnableIncludeLibGit2SharpInVsix)'=='' ">true</EnableIncludeLibGit2SharpInVsix>
</PropertyGroup>
<ItemGroup Condition=" '$(EnableIncludeLibGit2SharpInVsix)'=='true' ">
@sayedihashimi
sayedihashimi / update-templates-for-aspnet5.ps1
Created January 21, 2015 03:31
Update Visual Studio item templates to be available in ASP.NET 5 projects
$files = Get-ChildItem C:\Data\personal\mycode\side-waffle\TemplatePack\ItemTemplates\Web *.vstemplate -Recurse -Exclude C:\Data\personal\mycode\side-waffle\TemplatePack\ItemTemplates\Web\ASP.NET
foreach($filePath in $files){
[xml]$templateXml = Get-Content $filePath
$updatedFile = $false
'Processing [{0}]' -f $filePath | Write-Host
if($templateXml.VSTemplate.TemplateData.TemplateID){
@sayedihashimi
sayedihashimi / call-msdeploy.ps1
Last active September 14, 2016 16:18
Shows how to call msdeploy.exe from powershell
function Execute-CommandString{
[cmdletbinding()]
param(
[Parameter(Mandatory=$true,Position=0,ValueFromPipeline=$true)]
[string[]]$command,
[switch]
$ignoreExitCode
)
@sayedihashimi
sayedihashimi / fix-package-path.wpp.targets
Last active March 10, 2025 18:07
MSBuild wpp.targets file to fix the long path in web packages from Visual Studio
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PackagePath Condition=" '$(PackagePath)'=='' ">website</PackagePath>
<EnableAddReplaceToUpdatePacakgePath Condition=" '$(EnableAddReplaceToUpdatePacakgePath)'=='' ">true</EnableAddReplaceToUpdatePacakgePath>
<PackageDependsOn>
$(PackageDependsOn);
AddReplaceRuleForAppPath;
</PackageDependsOn>
@sayedihashimi
sayedihashimi / remove-bin-files.ps1
Last active August 29, 2015 14:16
PowerShell one liner which can be used to delete some temp files which are added to Visual Studio projects.
# PowerShell one liner which can be used to delete some temp files which are added to Visual Studio projects.
# ***Use at your own risk***
get-childitem "$env:userprofile\Documents" 'Visual Studio*' -Directory | % { Get-ChildItem $_.Fullname -Include bin,obj,packages,node_modules,artifacts -Directory -Recurse }|Select-Object -Property Fullname | % { if(Test-Path $_.FullName){Remove-Item $_.FullName -Recurse -Force -ErrorAction Continue }}