Skip to content

Instantly share code, notes, and snippets.

View GregTrevellick's full-sized avatar
💭
Nerding

Greg Trevellick GregTrevellick

💭
Nerding
View GitHub Profile
@miteshsureja
miteshsureja / Program.cs
Last active July 5, 2023 12:27
How to execute PowerShell script or cmdlets from C# code?
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Management.Automation;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@DanDiplo
DanDiplo / JS-LINQ.js
Last active October 31, 2024 12:33
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// First: This version using older JavaScript notation for universal browser support (scroll down for ES6 version):
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
@wonderful-panda
wonderful-panda / weakevent.cs
Created July 8, 2014 22:12
オレオレWeakEvent
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Linq.Expressions;
using System.Diagnostics;
namespace WonderfulPanda.Gists
{
@glombard
glombard / tfs-checkout-sample.bat
Last active September 30, 2019 09:50
TFS checkout files from a batch file
@echo off
setlocal EnableExtensions
set tfuser=glombard
set tflogin=/login:DOMAIN\%tfuser%,password
set tfworkspace=TFSWorkspace
set tfdir=C:\temp\MyWorkspace
set tfsource=$/PROJ/Source
set tfurl=http://127.0.0.1:8080/tfs/TEAM/
@priore
priore / gist:7163408
Created October 25, 2013 23:32
ASP.NET [C#] Redirect with post data
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections.Specialized;
using System.Text;
// ASP.NET [C#] REDIRECT WITH POST DATA
public static class WebExtensions
{
@steelheaddigital
steelheaddigital / ExampleUsage
Created July 30, 2012 23:01
An extension of the ASP.NET MVC WebGrid HTML helper to add a total row
In the ViewModel or Controller, create a new TotalWebGrid and return it to the view, just like with the normal WebGrid.
public TotalWebGrid Grid
{
get
{
return new TotalWebGrid(
source: stagingBillLines,
rowsPerPage: 10,
ajaxUpdateContainerId: "BillLines");
static void Main(string[] args)
{
using (SvnClient client = new SvnClient())
{
SvnInfoEventArgs serverInfo;
SvnInfoEventArgs clientInfo;
SvnUriTarget repos = new SvnUriTarget("http://svn.test.com/demo");
SvnPathTarget local = new SvnPathTarget(@"d:\Work\Code\demo");
client.GetInfo(repos, out serverInfo);