Skip to content

Instantly share code, notes, and snippets.

View sayedihashimi's full-sized avatar

Sayed Ibrahim Hashimi sayedihashimi

View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0"
DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutDir Condition=" '$(OutDir)'=='' ">$(MSBuildThisFileDirectory)bin\</OutDir>
<Configuration Condition=" '$(Configuration)'=='' ">Release</Configuration>
<SourceHome Condition=" '$(SourceHome)'=='' ">$(MSBuildThisFileDirectory)src\</SourceHome>
<ToolsHome Condition=" '$(ToolsHome)'=='' ">$(MSBuildThisFileDirectory)tools\</ToolsHome>
@sayedihashimi
sayedihashimi / Display-MessageInForegroundColors.ps1
Last active August 29, 2015 13:58
Powershell display message in all foreground colors
function Display-MessageInForegroundColors {
[cmdletbinding()]
param(
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
$message
)
process{
[enum]::getvalues([type]'ConsoleColor') | ForEach-Object{
$curForeground = $_
'{0}: {1}' -f $message,$curForeground | Write-Host -ForegroundColor $curForeground
@sayedihashimi
sayedihashimi / get-image-optimizer.ps1
Last active August 29, 2015 14:03
Script which can be used to optimize images. All you need to do is download the script and call it. The script will download the files it needs to run.
function OptimizeImages{
[cmdletbinding()]
param(
$folder,
$force = $false,
$customTemp = "$env:LocalAppData\CustomPublish\",
$imgOptUrl = 'https://raw.githubusercontent.com/ligershark/AzureJobs/master/ImageCompressor.Job/optimize-images.ps1'
)
process{
if(!(Test-Path $customTemp)){New-Item $customTemp -ItemType Directory}
@sayedihashimi
sayedihashimi / remove-items.ps1
Last active August 29, 2015 14:04
Uses MSBuild to remove items from the project file
[cmdletbinding()]
param(
[Parameter(
Mandatory=$true,
Position=0,
ValueFromPipeline=$true)]
$folder,
[bool]$backup = $true,
@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 / 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 / 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 }}