Skip to content

Instantly share code, notes, and snippets.

View mikeminutillo's full-sized avatar
🏠
Working from home

Mike Minutillo mikeminutillo

🏠
Working from home
View GitHub Profile
@mikeminutillo
mikeminutillo / 1.techtribes.context.c4
Created July 18, 2014 17:45
Architecture Definition DSL - Multi-file with components
internal system techtribes.je
desc techtribes.je is the only way to keep up to date with the IT, tech and digital sector in Jersey and Guernsey, Channel Islands
uses Twitter
Gets profile information and tweets from.
uses Github
Gets information about public code repositories from.
uses Blogs
Gets content using RSS and Atom feeds from.
external person Anonymous User
@mikeminutillo
mikeminutillo / Architecture Definition
Last active August 29, 2015 14:04
High level DSL for describing architectures according to the model outlined in http://www.codingthearchitecture.com/2014/06/24/software_architecture_as_code.html
internal system techtribes.je
desc techtribes.je is the only way to keep up to date with the IT, tech and digital sector in Jersey and Guernsey, Channel Islands
uses Twitter
Gets profile information and tweets from.
uses Github
Gets information about public code repositories from.
uses Blogs
Gets content using RSS and Atom feeds from.
container Web Application
desc Allows users to view people, tribes, content, events, jobs, etc from the local tech, digital and IT sector.
@mikeminutillo
mikeminutillo / gist:8592337
Created January 24, 2014 05:04
Evenly space columns for objects in LINQPad
object MultiColumn (params object[] values)
{
if(values.Length < 1) return null;
var width = 1m / values.Length;
return Util.RawHtml (
new XElement ("table",
new XElement("colgroup",
Enumerable.Repeat(1, values.Length).Select (e => new XElement("col", new XAttribute("style", String.Format("width: {0:0%}", width)))).ToArray()
),
new XElement ("tr", values.Select (v =>
@mikeminutillo
mikeminutillo / gist:8346775
Created January 10, 2014 03:58
Embed Google Chart API graph into LINQPad Results window
Util.RawHtml(@"<script type=""text/javascript"" src=""https://www.google.com/jsapi""></script>").Dump();
Util.RawHtml(@"<div id=""chart_div"" style=""width: 1024px; height: 1024px;""></div>").Dump();
var script = new StringBuilder();
script.AppendLine(@"
<script type=""text/javascript"">
google.load(""visualization"", ""1"", {packages:[""corechart""]});
google.setOnLoadCallback(drawChart);
function drawChart() {
@mikeminutillo
mikeminutillo / AwesomeWeb.cs
Created December 11, 2013 07:23
Create a new Console App, Install all of the Packages (or enable package restore and hand-edit the packages.config file), Create a Web Folder and move your Scripts folder into it, Create Home.html in the root of /Web, mark all of the child files of /Web as Copy Always. Hit F5 and go to your browser for NancyFx, SignalR and static file hosting on…
using Microsoft.AspNet.SignalR;
using Microsoft.Owin.Hosting;
using Nancy;
using Nancy.Owin;
using Owin;
using System;
using System.IO;
using System.Reflection;
public class Program
@mikeminutillo
mikeminutillo / MemoryProfileRegion.cs
Created November 27, 2013 07:05
Regions to assist with debugging applications
public class MemoryProfileRegion : IDisposable
{
private static readonly ILog Log = LogManager.GetLogger("Profiling");
private readonly string _name;
private readonly long _initialMemory;
private MemoryProfileRegion(string name)
{
_name = name;
@mikeminutillo
mikeminutillo / Permissions.cs
Created August 1, 2013 07:30
Using Autofac resolution to set boolean flags indicating if the user is allowed to perform some action
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class PermissionAttribute : Attribute
{
public string RequiredPermission { get; set; }
public PermissionAttribute(string requiredPermission)
{
RequiredPermission = requiredPermission;
}
}
@mikeminutillo
mikeminutillo / FizzBuzz.sql
Created May 2, 2013 02:58
An implementation of FizzBuzz in T-SQL
with t as (select 1 x union all select x + 1 from t where x < 100)
select case
when x % 3 = 0 AND x % 5 = 0 then 'FizzBuzz'
when x % 3 = 0 then 'Fizz'
when x % 5 = 0 then 'Buzz'
else CAST(x as varchar)
end
from t
@mikeminutillo
mikeminutillo / WebApiClient.cs
Created April 13, 2013 04:13
WebAPI simple http client
var request = WebRequest.Create("http://localhost:63180/api/values") as HttpWebRequest;
request.Accept = "text/xml;text/json";
var response = request.GetResponse() as HttpWebResponse;
new { response.StatusCode, response.ContentType }.Dump("Details");
using(var stream = response.GetResponseStream())
using(var reader = new StreamReader(stream))
reader.ReadToEnd().Dump("Pay Load");
@mikeminutillo
mikeminutillo / dicetowervideoclassifier.cs
Created April 9, 2013 04:58
Loads all of the videos uploaded by "thedicetower" and categorizes them
void Main()
{
var entries = GetEntries().Cache("from-youtube");
(from e in entries
let category = Categorize(e.Title)
group e by category into g
orderby g.Key descending
select new
{