Skip to content

Instantly share code, notes, and snippets.

💭
🐱‍🐉

Aaron Powell aaronpowell

💭
🐱‍🐉
Block or report user

Report or block aaronpowell

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@aaronpowell
aaronpowell / gist:8776893
Created Feb 2, 2014
Delete wifi profiles in Windows
View gist:8776893
function PromptForRemoval {
param (
[string]
[Parameter(Mandatory=$true)]
$Networkname
)
$title = "Delete network $NetworkName"
$message = "Do you want to delete the wifi network named $NetworkName"
@aaronpowell
aaronpowell / regex.md
Created Feb 12, 2014
Convert `Assert.IsTrue` to a useful assert statement
View regex.md

So I really hate when people use Assert.IsTrue(a == b) as an assertion in a unit test (I blogged my rant) so I decided to find a way to easily convert large test files to be more normal.

Search Regex

You'll want to search with this:

Assert\.IsTrue\((?<Actual>.*)\s*==\s*(?<Expected>.*)\)
//or if your language doesn't support named caprutes use:
Assert\.IsTrue\((.*)\s*==\s*(.*)\)
@aaronpowell
aaronpowell / grunt-tfpt-uu.js
Created Feb 18, 2014
TFS PowerTools undo unchanged files
View grunt-tfpt-uu.js
var tfptPath = 'C:\\Program Files (x86)\\Microsoft Team Foundation Server 2013 Power Tools\\TFPT.EXE';
grunt.registerTask('tfpt-uu', 'Undo changes to unchanged files in the workspace (required TFs PowerTools 2013', function () {
var fs = require('fs');
var cb = this.async();
fs.exists(tfptPath, function (exists) {
if (!exists) {
grunt.warn('TFS Power Tools are not installed, aborting...');
cb();
@aaronpowell
aaronpowell / grunt-tf-checkout.js
Created Feb 17, 2014
Grunt task for checking out files from TFVC
View grunt-tf-checkout.js
var tfPath = 'C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\TF.exe';
grunt.registerTask('tf-checkout', 'Checks out a location from TFS', function (path, recursive) {
var cb = this.async();
var recursiveFlag = recursive ? '/recursive' : '';
var child = grunt.util.spawn({
cmd: tfPath,
args: ['checkout', path, recursiveFlag]
}, function (err, result, code) {
if (err) {
grunt.fatal(err);
@aaronpowell
aaronpowell / gist:9085724
Created Feb 19, 2014
AngularJS macros in Sweet.js
View gist:9085724
let module = macro {
case {_
$name
import $params (,) ...
} => {
letstx $name_str = [makeValue(unwrapSyntax(#{$name}), #{here})];
return #{
angular.module($name_str, [$params (,) ...])
};
}
@aaronpowell
aaronpowell / nth-child.md
Created Mar 11, 2014
TIL: how nth-child works
View nth-child.md

Today I learnt an interesting fact about how the nth-child CSS selector works and it was different to what I expected and what seems to make sense.

I had the following HTML snippet:

<div class="input-group">
        <div class="legacy">
                <div class="input-subgroup">
                    <input name="itemId" id="Type0" type="radio" checked="checked" value="1">
                    <label for="Type0">Single</label>
                </div>
@aaronpowell
aaronpowell / multi-reset.sh
Last active Aug 29, 2015
Resetting multiple files
View multi-reset.sh
#!/bin/sh
# Change the regex in `egrep` to match the pattern you want to reset
git status -s | grep "^A" | sed 's/A //' | while read i; do git reset HEAD $i; done
@aaronpowell
aaronpowell / multi-diff.sh
Created Mar 26, 2014
Diff multiple files in git
View multi-diff.sh
#!/bin/sh
git status -s | grep "^ M .*\.cs$" | sed 's/ M //' | while read i; do git diff --ignore-space-change $i; done
@aaronpowell
aaronpowell / null-guard.sjs
Last active Aug 29, 2015
Trying out the C# vNext `?.` operator in Sweet.js
View null-guard.sjs
macro null_helper {
rule { ($processed ...) ($rest) } => {
$processed (.) ... . $rest
}
rule { ($processed ...) ($rest_head $rest ...) } => {
$processed (.) ... . $rest_head
&& null_helper ($processed ... $rest_head) ($rest ...)
}
}
@aaronpowell
aaronpowell / gist:10609659
Created Apr 14, 2014
Umbraco document types grouped by the count of pages that use it (run via LINQPad)
View gist:10609659
(from dt in CmsDocumentTypes
join n in UmbracoNodes on dt.ContentTypeNodeId equals n.Id
select new {
n.Id,
n.Text,
Docs = CmsContents.Where(c => c.ContentType == n.Id).Where(c => !c.Node.Trashed).Count(),
IsNested = n.ParentID != -1
})
.Distinct()
.GroupBy(x => x.Docs)
You can’t perform that action at this time.