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
View PubSub.ts
module PubSub {
interface ISubscription {
(...args: any[]): void;
}
interface IDictionary {
[name: string] : ISubscription[];
}
var registry : IDictionary = {
View agenda.js
import * as cheerio from 'cheerio'
export const fetchAgenda = async () => {
const response = await fetch('https://ndcsydney.com/agenda')
const body = await response.text()
const talks = []
const $ = cheerio.load(body)
$('section.day').map((i, el) => {
// prettier-ignore
@aaronpowell
aaronpowell / LogicApp.json
Created Apr 17, 2019
Auto tweeting logic app
View LogicApp.json
{
"$connections": {
"value": {
"rss": {
"connectionId": "/subscriptions/7e2b0a07-47db-4a2e-bfca-03c0d5b75f15/resourceGroups/personal-website/providers/Microsoft.Web/connections/rss",
"connectionName": "rss",
"id": "/subscriptions/7e2b0a07-47db-4a2e-bfca-03c0d5b75f15/providers/Microsoft.Web/locations/southcentralus/managedApis/rss"
},
"twitter": {
"connectionId": "/subscriptions/7e2b0a07-47db-4a2e-bfca-03c0d5b75f15/resourceGroups/personal-website/providers/Microsoft.Web/connections/twitter",
@aaronpowell
aaronpowell / parser.cs
Last active Feb 26, 2019
C# parser in F#
View parser.cs
using System;
using System.Collections.Generic;
namespace Parser.CSharp
{
public static class ParserCSharp
{
public static string[] ParseCommandline(string input)
{
var items = new List<string>();
@aaronpowell
aaronpowell / selectMany.js
Created Nov 19, 2012
LINQ SelectMany in JavaScript
View selectMany.js
Array.prototype.selectMany = function (fn) {
return this.map(fn).reduce(function (x, y) { return x.concat(y); }, []);
};
// usage
console.log([[1,2,3], [4,5,6]].selectMany(function (x) { return x; })); //[1,2,3,4,5,6]
console.log([{ a: [1,2,3] }, { a: [4,5,6] }].selectMany(function (x) { return x.a; }));
@aaronpowell
aaronpowell / annotations.sjs
Created May 13, 2014
Type annotations and checking with Sweet.js
View annotations.sjs
macroclass typedef {
pattern { $x:ident : $type:ident }
pattern { $x:ident : $type:lit }
}
let function = macro {
rule { $name ($params:typedef ...) { $body ... } } => {
function $name ($params$x ...) {
$(if (typeof $params$x !== typeof $params$type) {
throw new Error('Found type ' + (typeof $params$x) + ' but expected ' + typeof $params$type);
@aaronpowell
aaronpowell / BulkNuGetInstall.ps1
Created Feb 25, 2011
Install NuGet across all projects
View BulkNuGetInstall.ps1
#Installs a package into all projects in the solution (note: Requires NuGet 1.1+)
Get-Project -All | Install-Package packageName
@aaronpowell
aaronpowell / DemoTest.cs
Created Apr 10, 2018
Testing Fluidity with Chauffeur.TestingTools
View DemoTest.cs
using Chauffeur.TestingTools;
using Fluidity.Configuration;
using Fluidity.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Umbraco.Core;
using Xunit;
@aaronpowell
aaronpowell / async.js
Created Apr 19, 2017
Abusing JavaScript async
View async.js
function async(async) {
return new Promise(res =>
setTimeout(() => (console.log(async), res()), 1000)
);
}
async function await() { await async('hello'); }
await();
@aaronpowell
aaronpowell / StringTypeProvider.fs
Created Feb 6, 2015
A basic Type Provider for taking a string and making something silly.
View StringTypeProvider.fs
namespace Samples.FSharp.StringTypeProvider
open System
open System.Reflection
open Samples.FSharp.ProvidedTypes
open Microsoft.FSharp.Core.CompilerServices
open Microsoft.FSharp.Quotations
[<TypeProvider>]
type StringTypeProvider(config: TypeProviderConfig) as this =
You can’t perform that action at this time.