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 ThingThatGetsMeData : IThingThatGetsMeData | |
{ | |
public Data GetTheData() | |
{ | |
// database loading logic | |
} | |
} | |
public class CachingThingThatGetsMeData : IThingThatGetsMeData |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>JustGiving.Data</title> | |
</head> | |
<body> | |
<div> | |
<h1>JGM Example</h1> |
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 StringParsingNeedsToBeSimpler | |
{ | |
public void HereAreSomeExamples() | |
{ | |
//You know what sucks? | |
string value = "123"; | |
int outt; | |
if(!int.TryParse(value, out outt)) | |
{ | |
outt = 12345; // my default! |
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 Settings : ConfigurationSection | |
{ | |
[ConfigurationProperty("enabled", DefaultValue = "false", IsRequired = true)] | |
public bool Enabled | |
{ | |
get { return (bool)this["enabled"]; } | |
set { this["enabled"] = value; } | |
} | |
[ConfigurationProperty("cloudFrontDomainName", DefaultValue = "", IsRequired = true)] |
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 NinjectActivation : IHandlerActivationStrategy | |
{ | |
private readonly IEventHandlerResolver _eventHandlerResolver; | |
private readonly IKernel _singleKernel; | |
private readonly ConcurrentDictionary<object, IKernel> _scopes; | |
public NinjectActivation(IKernel singleKernel) | |
{ | |
_eventHandlerResolver = new EventHandlerResolver(); |
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 System; | |
namespace FleuntExample | |
{ | |
public class BootstrappingYourLibrariesWithFluentApis | |
{ | |
public BootstrappingYourLibrariesWithFluentApis() | |
{ | |
// To make my library, I can instantiate everything independantly | |
var firstD1 = new Dependency(); |
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
<!DOCTYPE HTML> | |
<html> | |
<body> | |
Hello. | |
<script type="text/javascript"> | |
console.time("Test"); | |
writeJunk("logging 1"); | |
console.timeEnd("Test"); |
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 System; | |
using Nancy; | |
using Nancy.Hosting.Self; | |
namespace WebServer | |
{ | |
class Program | |
{ | |
static void Main() | |
{ |
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 Engine<T> where T: IEngineComponent | |
{ | |
private readonly T _component; | |
protected bool ContinueLooping; | |
private Thread _thread; | |
public Engine(T component) | |
{ | |
_component = component; | |
} |
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
The MP3 file format, didn't provide any means for including metadata about the song. ID3 tags were invented to solve this problem. | |
You can tell if an MP3 file includes ID3 tags by examining the last 128 bytes of the file. If they begin with the characters TAG, you have found an ID3 tag. The format of the tag is as follows: | |
TAG song artist album year comment genre | |
The spec is here: http://id3.org/ID3v1 | |