Skip to content

Instantly share code, notes, and snippets.

View slang25's full-sized avatar
🙂

Stuart Lang slang25

🙂
View GitHub Profile
@martincostello
martincostello / Program.cs
Last active May 21, 2022 10:54
Converts C# source files to use file-scoped namespaces
// There may be corner cases where the naive string matching incorrectly
// changes your source file. Check your diff before committing any changes.
using System.Text;
// Change to whatever your favourite indentation is
const string Indent = " ";
// Get all the C# files in the specified directory
var fileNames = Directory.GetFiles(args[0], "*.cs", SearchOption.AllDirectories);
@jamessdixon
jamessdixon / CSharpToFSharp
Created August 31, 2018 12:17
Convert Auto-Generatd C# classes to F# Types
open System
open System.IO
open System.Collections.Generic
let path = @"C:\Git\..."
let folderInfo = System.IO.DirectoryInfo(path)
let files = folderInfo.GetFiles("*.cs")
let parseClass (values: IEnumerable<string>) =
let className =
@seanfisher
seanfisher / AsyncInitializationController.cs
Last active April 10, 2023 12:42
A pattern for a Xamarin.iOS controller that permits "safe" async lifecycle methods.
using System;
using System.Threading.Tasks;
using UIKit;
namespace Seanfisher.Gists
{
public abstract class AsyncInitializationController : UIViewController
{
Task _viewDidLoadAsyncTask = Task.CompletedTask;
public virtual Task ViewDidLoadAsync()
@yetanotherchris
yetanotherchris / teamcity-trigger-build.ps1
Last active October 31, 2021 23:31
Trigger another Teamcity build as a build step (because Teamcity triggers lose the triggeredBy environmental variable)
# Trigger the acceptance tests
# Docs: https://confluence.jetbrains.com/display/TCD8/REST+API#RESTAPI-TriggeringaBuild
$branchName = "%teamcity.build.branch%"
$url = "http://teamcity.mydomain.com:8500/guestAuth/app/rest/buildQueue"
$buildId = "%system.teamcity.buildType.id%"
$buildId = $buildId.Replace("_Deploy", "_AcceptanceTests")
$webClient = New-Object net.webclient
@davidfowl
davidfowl / dotnetlayout.md
Last active May 3, 2024 08:40
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/