Skip to content

Instantly share code, notes, and snippets.

<#
.SYNOPSIS
Gets a PowerShell Credential (PSCredential) from the Windows Credential Manager
.DESCRIPTION
Adapted from: http://stackoverflow.com/questions/7162604/get-cached-credentials-in-powershell-from-windows-7-credential-manager
.PARAMETER TargetName
The name of the target login informations in the Windows Credential Manager
using Contrib.Navigation.Models;
using Orchard;
using Orchard.ContentManagement;
using Orchard.Logging;
using Orchard.Roles.Models;
using Orchard.Roles.Services;
using Orchard.Security;
using Orchard.Security.Permissions;
using Orchard.UI.Admin;
using Orchard.UI.Navigation;
@toburger
toburger / EnumerableExtensions.cs
Created October 1, 2012 09:09
Enumerable Extension Method to Distinct or Union IEnumerable(s) by a property without the need to create an IEqualityComparer<T> implementation.
static class EnumerableExtensions
{
public static IEnumerable<T> Distinct<T, TProperty>(
this IEnumerable<T> source,
Expression<Func<T, TProperty>> propertyExpression)
{
return source.Distinct(
new PropertyExpressionComparer<T, TProperty>(propertyExpression));
}
param ([string]$ComputerName = '*')
begin {
filter Check-Online {
trap { continue }
. {
$timeout = 1000
$obj = New-Object system.Net.NetworkInformation.Ping
$result = $obj.Send($_, $timeout)
if ($result.status -eq 'Success') { $_ }
@toburger
toburger / Get-GistFile.ps1
Created January 9, 2013 15:15
Gets the content of a gist which you can then save as a file: .\Get-GistFile.ps1 gist_id > filename.ext
param([Parameter(Mandatory)]$Id)
$response = Invoke-WebRequest https://api.github.com/gists/$Id
$gist = $response.Content | ConvertFrom-Json
$gist.files | gm -MemberType NoteProperty | select -First 1 | % {
$file = $gist.files."$($_.Name)"
$file.content
Write-Verbose "filename: $($file.filename)"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Intranet
{
public static class MenuExtensions
{
public static IMenu NextSibling(this IMenu menu)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Intranet
{
public class GlobalContainer
{
public static SmgIntranetContainer Instance
@toburger
toburger / dabblet.css
Created April 3, 2013 10:04 — forked from anonymous/dabblet.css
Untitled
nav {
width: 100%;
float: left;
}
nav ul {
list-style: none;
padding: 0px;
margin: 0px;
}
nav li {
nav {
width: 100%;
float: left;
}
nav ul {
list-style: none;
padding: 0px;
margin: 0px;
}
nav li {
@toburger
toburger / dabblet.css
Created April 4, 2013 09:27 — forked from anonymous/dabblet.css
Simple CSS only flyout menu
/**
* Simple CSS only flyout menu
*/
body {
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
font-family: Arial;
}