Skip to content

Instantly share code, notes, and snippets.

View aaronpowell's full-sized avatar
😶‍🌫️

Aaron Powell aaronpowell

😶‍🌫️
View GitHub Profile
@aaronpowell
aaronpowell / gist:d798507cbca08d86b41a
Created April 30, 2014 05:13
Find csproj files referencing an assembly
Get-ChildItem -Filter *.csproj -Recurse |
Select-Object -Property FullName,@{N="Xml"; E = {
Select-Xml -Path $_.FullName -XPath //b:Reference -Namespace @{b='http://schemas.microsoft.com/developer/msbuild/2003'} |
Select-Object -ExpandProperty Node |
Select-Object -Property Include, HintPath |
Where-Object { $_.HintPath -ne $null } |
Where-Object { $_.Include -eq "My.Assembly.Name" }
} } |
Where-Object { $_.Xml -ne $null } |
Out-GridView
public class AuthenticationController : ApiController {
public void SomethingThatIsPublic(Something something) { /* not important */ }
public HttpResponseMessage Post(LoginModel model) {
//do login
//return
}
}
@aaronpowell
aaronpowell / gist:14eadedddbd1b8f91c6c
Last active August 29, 2015 14:00
Sweet.js sublime text build system
{
"cmd": ["sjs", "$file", "-o", "$file_base_name.js"],
/*"file_regex": "", TODO: Work this out*/
"selector": "source.sjs"
}
//ref: http://docs.sublimetext.info/en/latest/file_processing/build_systems.html
@aaronpowell
aaronpowell / gist:e7bcb3942848c3a9a67d
Created May 6, 2014 04:08
Handling merge conflicts during a rebase (or any time) when you just want someone's version
git ss | grep "^UU" | sed 's/UU//' | while read i; do git checkout --theirs $i && git add $i; done
# change `--theirs` to `--ours` to take your own version
@aaronpowell
aaronpowell / in.sjs
Created May 6, 2014 05:44
sweet.js in operator to handle arrays
operator (in) 10 left { $l, $r} => #{ Array.isArray($r) ? !~$r.indexOf($l) : !!$r[$l] }
var x = 7 in [1,2,3,4];
@aaronpowell
aaronpowell / AppTabby.cs
Last active August 29, 2015 14:01
A simple app which issues alt + tab (or ctrl + tab) periodically
using System;
using System.Threading;
using System.Windows.Forms;
namespace AltTabby
{
class Program
{
static void Main(string[] args)
{
@aaronpowell
aaronpowell / express.sjs
Last active August 29, 2015 14:01
Express DLS
let get = macro {
rule { $path:lit $do $res:lit } => {
app.get($path, function (req, res) {
res.$do($res);
});
}
rule { $path:lit $do:ident($sc:lit) $res:lit } => {
app.get($path, function (req, res) {
res.$do($res);
res.status($sc);
@aaronpowell
aaronpowell / app.js
Last active August 29, 2015 14:01
Express.js + Sweet.js + modules
var express = require('express');
var app = express();
get '/404' send(404) 'Not Found'
get '/foo' with (req, res) {
res.json({ foo: 'bar' });
}
@aaronpowell
aaronpowell / test.js
Created July 8, 2014 22:56
Simple request asserting
var request = require('requst'); //npm install request
var assert = require('assert'); //build in to Node.js
request('http://httpstat.us/200', function (err, res, body) {
assert.equal(res.statusCode, 200, 'Expected a 200 response');
});
@aaronpowell
aaronpowell / parser.js
Created July 14, 2014 02:05
Parse an Octopus deployment and determine duration of each step
var dateItems = [].slice.call(document.querySelectorAll('.log-date span'));
var dates = dateItems.map(function (item) {
return { span: item, date: Date.parse(item.getAttribute('title')) };
}).map(function (item, index, arr) {
var next = arr[index + 1] || item;
return {
span: item.span,
date: item.date,
next: next