Skip to content

Instantly share code, notes, and snippets.

View sayedihashimi's full-sized avatar

Sayed Ibrahim Hashimi sayedihashimi

View GitHub Profile
@sayedihashimi
sayedihashimi / nopreorpostevents.targets
Created April 16, 2015 09:47
This file will disable pre and post build events globally in MSBuild and Visual Studio
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
You can use this file to disable pre and post events globally across both MSBuild and Visual Studio.
To use this file, you have two options.
1. Save this file as C:\Program Files (x86)\MSBuild\v14.0\Custom.After.Microsoft.Common.targets
Or whatever the value of the MSBuild property $(CustomAfterMicrosoftCommonTargets).
2. Save this file to a random location, lets say C:\temp\msbuild\nopreorpostevents.targets,
then set the CustomAfterMicrosoftCommonTargets env var to point to that file. Then start Visual Studio.
@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 / transform-xml.ps1
Last active January 17, 2024 20:02
Script which can be used to transform an XML file using XDT. All you need to do is download the script and call it. The script will download the files it needs to run.
#!/usr/bin/env powershell
<#
.SYNOPSIS
You can use this script to easly transform any XML file using XDT.
To use this script you can just save it locally and execute it. The script
will download its dependencies automatically.
Created by sayediHashimi
Modified by obscurerichard
Thanks Stack Overflow: https://stackoverflow.com/questions/8989737/web-config-transforms-outside-of-microsoft-msbuild
@sayedihashimi
sayedihashimi / getnuget.proj
Last active July 26, 2022 19:53
Samples showing how to download nuget in a scrpit to avoid checking it in
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="GetNuget">
<!--
This is an MSBuild snippet that can be used to download nuget to the path
in the property NuGetExePath property.
Usage:
1. Copy and paste this into your build script
2. Call the GetNuGet target before you use nuget.exe from $(NuGetExePath)
@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 / show-console-colors.ps1
Last active May 29, 2021 17:07
PowerShell loop through console colors to display different results for foreground color & background color
[enum]::getvalues([type]'ConsoleColor') | ForEach-Object{
$curForeground = $_
[enum]::getvalues([type]'ConsoleColor') | ForEach-Object{
$curBackground = $_
$msgStart= "Foreground={0}, Background={1}" -f $curForeground,$curBackground
$msgStart += (New-Object string -ArgumentList @(' ',(50-$msgStart.Length)))
$msgStart | Write-Host -NoNewline
@sayedihashimi
sayedihashimi / 18-steps-for-perfect-rice
Last active October 13, 2015 10:58
How to cook rice
1. Place basmati rice into a bowl, rinse it with water a couple times
2. Soak the rice with clean cold water for at least 4 hours. Make sure to stir the rice good when soaking so that the grains don't stick together
3. After rice has soaked, dump the water it was soaking in. Rinse the rice with fresh water a few times
4. Bring some water to a boil in a pot, add some salt to the water too
5. Add rice to water (there water should fully cover the rice with some room to spare)
6. Let the rice come to a solid boil (stirring occasionally to ensure rice doesn't stick together)
7. Let the rice boil until the rice has softened up (crush some rice between your figers to judge). When its almost soft enough to eat take it off the heat
8. Drain out the water from the rice
9. Rinse rice with fresh cold water
10. Drain out the water from the rice (make sure its really dry you want to avoid any left over water here)