Skip to content

Instantly share code, notes, and snippets.

View jaredpar's full-sized avatar

Jared Parsons jaredpar

View GitHub Profile
def main():
#Declare
price = 99
quantity = float(input("How many packages have you purchased?"))
if quantity >= 10:
print ("Your discount is 20%.")
set nobackup
set nocp
set tabstop=4
set shiftwidth=4
set et
set ignorecase
set hlsearch
set ai
set ruler
private static string s_root = @"e:\dd\ros\Closed";
private static Encoding s_encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false);
static void Main(string[] args)
{
FixPackagesConfig();
FixProjects();
}
static void FixPackagesConfig()
@jaredpar
jaredpar / gist:a9b27a4d3a7c8c89afa7
Created May 22, 2015 18:01
Roslyn Alt Repro Issue 2908
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
namespace RoslynCCPhantoms
{
static class Contract
@jaredpar
jaredpar / gist:c2125da173e488826b9b
Created July 1, 2015 17:28
Fuzzy interface hookup
// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.33440
// Copyright (c) Microsoft Corporation. All rights reserved.
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
@jaredpar
jaredpar / gist:e73f8e65543fe799da64
Created July 10, 2015 20:51
Sometimes you just gotta Roslyn Roslyn
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Text;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis;
@jaredpar
jaredpar / gist:4b2467622cd37fc1f654
Created July 10, 2015 20:51
Sometimes you just gotta Roslyn Roslyn
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Text;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis;
@jaredpar
jaredpar / gist:c1448523c9553884623f
Created October 5, 2015 16:26
VsVars for Powershell
function Set-DevEnvironment() {
param ( [string]$version = $(throw "Need a VS version"))
$vsPath = "Microsoft Visual Studio $version.0\VC\vcvarsall.bat"
$target = join-path (Get-ProgramFiles32) $vsPath
. Import-Environment $target
}
# This method will execute a batch file and then put the resulting
# environment into the current context
@jaredpar
jaredpar / gist:302be1e7b7fcf4d983a8
Created October 15, 2015 17:39
Powershell array member access
> $a = new-object System.Collections.Queue
> $a.enqueue($null)
> $a.enqueue($null)
> $a.enqueue($null)
> $a.enqueue($null)
> $a.enqueue($null)
> $a
> $a.Count
5
> $b = @($null)
SourceText text;
using (var stream = File.OpenRead(filePath))
{
text = SourceText.From(stream);
}
var syntaxTree = CSharpSyntaxTree.ParseText(text);
var node = syntaxTree.GetRoot();
var newNode = /* maybe mutate the tree */
if (node != newNode)