Skip to content

Instantly share code, notes, and snippets.

View ryanrousseau's full-sized avatar
🏠
Working from home

Ryan Rousseau ryanrousseau

🏠
Working from home
View GitHub Profile
using System;
using ScriptCs.Contracts;
namespace ScriptCs.Exec
{
[Module("print", Extensions = "csx")]
public class PrintModule : IModule
{
public void Initialize(IModuleConfiguration config)
{
using System;
using ScriptCs.Contracts;
namespace ScriptCs.Exec
{
public class PrintLinePreprocessor : DirectiveLineProcessor
{
public PrintLinePreprocessor()
{
Console.WriteLine("PrintLinePreprocessor created");
#print hello world
Console.WriteLine("Done");
using System.Collections.Generic;
using System.Linq;
using Common.Logging;
using ScriptCs.Contracts;
namespace ScriptCs.Exec
{
public class PrintFilePreprocessor : FilePreProcessor
{
public PrintFilePreprocessor(IFileSystem fileSystem, ILog logger, IEnumerable<ILineProcessor> lineProcessors)
@ryanrousseau
ryanrousseau / gist:10731562
Last active August 29, 2015 13:59
Possible fix for IsNonDirectiveLine
public interface IDirectiveLineProcessor : ILineProcessor
{
bool Matches(string line);
}
public abstract class DirectiveLineProcessor : ILineProcessor
{
...
public bool Matches(string line)
{
Write-Output "Checking ChocolateyInstall env variable"
$chocolateyInstall = [Environment]::GetEnvironmentVariable("ChocolateyInstall")
if (!$chocolateyInstall) {
Write-Output "ChocolateyInstall env variable does not exist, using $ChocolateyInstallDir"
$chocolateyInstall = $ChocolateyInstallDir
[Environment]::SetEnvironmentVariable("ChocolateyInstall", $chocolateyInstall)
[Environment]::SetEnvironmentVariable("ChocolateyInstall", $chocolateyInstall, "Machine")
}
@ryanrousseau
ryanrousseau / OAuth2Authorize.cs
Created June 22, 2012 13:30
OAuth2 Authorize Attribute for MVC Web API
using System;
using System.Net;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Security.Principal;
using System.ServiceModel.Channels;
using System.Threading;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
Console.WriteLine("Hello from https://gist.github.com/ryanrousseau/0dca8b3a74958f82406a !");
#load "scriptTables.csx
ScriptTables("server", "db", "targetDirectoryPath");
public class Greeter
{
public void Greet(string message)
{
Console.WriteLine(message);
}
}