Skip to content

Instantly share code, notes, and snippets.

View sawilde's full-sized avatar

Shaun Wilde sawilde

View GitHub Profile
@sawilde
sawilde / gist:2419627
Created April 19, 2012 08:21
load in a CSV file and wrap any field that isn't already in quotes with quotes
class Program
{
/// <summary>
/// load in a CSV file and wrap any field that isn't in quotes with quotes
/// </summary>
/// <param name="args"></param>
static void Main(string[] args)
{
var reader = File.OpenText(Path.Combine(Directory.GetCurrentDirectory(),args[0]));
@sawilde
sawilde / Sort files
Created October 12, 2012 06:12
Take a list of files and sort them by name regardless of folder structure
$sorted = [IO.Directory]::GetFiles($path, "*.*", [System.IO.SearchOption]::AllDirectories) |
Select-Object @{Name="FullName"; Expression={$_}}, @{Name="FileName"; Expression={[IO.Path]::GetFileName($_)}} |
Sort-Object FileName
@sawilde
sawilde / enumerables_to_blocks.cs
Last active March 2, 2019 04:44
Break an array into blocks
var blockSize = 2;
var blocks = arrayListEnumerableOfThing
.Select((element, idx) => new { element, idx })
.GroupBy(x => x.idx / blockSize, x => x.element)
.Select(b => b.ToArray())
.ToArray();
using System;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using MYOB.AccountRight.SDK;
using MYOB.AccountRight.SDK.Communication;
using MYOB.AccountRight.SDK.Services;
namespace arl_winforms_sample
{
public partial class Form1 : Form
@sawilde
sawilde / CLA.md
Created February 24, 2016 09:28 — forked from pjcozzi/CLA.md
CLA for MIT license

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the MIT license; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the MIT license; or

@sawilde
sawilde / OpenCover_CLA.md
Last active January 11, 2021 02:34
OpenCover CLA for MIT license (Harmony)

OpenCover Individual Contributor License Agreement

Thank you for your interest in contributing to OpenCover ("We" or "Us"). This contributor agreement ("Agreement") documents the rights granted by contributors to Us. To make this document effective, please agree to it using the electronic submission process via https://cla-assistant.io/ when you submit your pull request; you will only need to resubmit should the agreement change. For more information please read the wiki article https://github.com/OpenCover/opencover/wiki/Contributor-License-Agreement-Q&A

This is a legally binding document, so please read it carefully before agreeing to it.

1. Definitions

"You" means the individual who Submits a Contribution to Us.

> git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git.exe config remote.origin.url https://github.com/gaurarpit12/ALM_POC.git # timeout=10
Fetching upstream changes from https://github.com/gaurarpit12/ALM_POC.git
> git.exe --version # timeout=10
> git.exe -c core.askpass=true fetch --tags --progress https://github.com/gaurarpit12/ALM_POC.git +refs/heads/*:refs/remotes/origin/*
> git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
> git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
Checking out Revision 65d7fe62fba9391450038cc9fdaf660f644a715b (refs/remotes/origin/master)
> git.exe config core.sparsecheckout # timeout=10
> git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git.exe config remote.origin.url https://github.com/gaurarpit12/ALM_POC.git # timeout=10
Fetching upstream changes from https://github.com/gaurarpit12/ALM_POC.git
> git.exe --version # timeout=10
> git.exe -c core.askpass=true fetch --tags --progress https://github.com/gaurarpit12/ALM_POC.git +refs/heads/*:refs/remotes/origin/*
> git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
> git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
Checking out Revision 65d7fe62fba9391450038cc9fdaf660f644a715b (refs/remotes/origin/master)
> git.exe config core.sparsecheckout # timeout=10
@sawilde
sawilde / regex_in_excel.vbs
Last active April 1, 2019 22:30
RegEx in excel
'Turn on developer bar
'Add Extension "Microsoft vbscript regex 5.5"
' - Select "Developer" tab (I don't have this tab what do I do?)
' - Select "Visual Basic" icon from 'Code' ribbon section
' - In "Microsoft Visual Basic for Applications" window select "Tools" from the top menu.
' - Select "References"
' - Check the box next to "Microsoft VBScript Regular Expressions 5.5" to include in your workbook.
' - Click "OK"
Public Function RegexExtract(ByVal text As String, ByVal expr As String)
@sawilde
sawilde / remove_git_branches.md
Last active March 2, 2019 04:36
An alias to iterate all 1st level child folders and remove all local branches not in the safelist

An alias to iterate all 1st level child folders and remove all local branches not in the safelist

alias -p bfg='for d in */; { echo $d; cd $d; { git checkout -q master; git branch | egrep -v "(^\*)|(^\s+(master|dev|hotfix|qa))" | xargs --no-run-if-empty git branch -D ; }; cd ..; };'

BEWARE: Only run if you are sure you really want to remove all branches not in the safe list - I normally do this at the end of a sprint/delivery and I know all branches are defunct other than master etc

NOTE: It can probably be improved