This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] | |
public class PermissionAttribute : Attribute | |
{ | |
public string RequiredPermission { get; set; } | |
public PermissionAttribute(string requiredPermission) | |
{ | |
RequiredPermission = requiredPermission; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// With massive help from http://securityxploded.com/iepasswordsecrets.php | |
var urlBytes = System.Text.Encoding.Unicode.GetBytes((url + '\0').ToLower()); | |
byte[] hashBytes; | |
using(var sha1 = new SHA1Managed()) | |
hashBytes = sha1.ComputeHash(urlBytes); | |
var checksum = hashBytes.Aggregate((x,y) => (byte)((int)x + (int)y)); | |
var keyBytes = hashBytes.Concat(new[] { checksum }).ToArray(); | |
var regKey = String.Join("", keyBytes.Select(x => x.ToString("X2"))); |