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
| require "rubygems" | |
| require "date" | |
| # Configuration | |
| base_dir = Dir.pwd | |
| blog_dir = "#{base_dir}/blog" | |
| source_dir = "#{blog_dir}/source" | |
| posts_dir = "#{source_dir}/_posts" | |
| git_remote = "origin" | |
| git_branch = "master" |
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 static bool HasHttpContext | |
| { | |
| get | |
| { | |
| try | |
| { | |
| var assembly = Assembly.Load("System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); | |
| Type httpContextType = assembly.GetType("System.Web.HttpContext"); | |
| PropertyInfo currentProperty = httpContextType.GetProperty("Current"); | |
| object value = currentProperty.GetValue(null, null); |
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
| /// <summary> | |
| /// Indicates that a model provides support for pagination. | |
| /// See http://twitter.github.com/bootstrap/components.html#pagination. | |
| /// </summary> | |
| public interface IPaginate | |
| { | |
| /// <summary> | |
| /// Gets the current page in the record set. | |
| /// </summary> | |
| int Page { get; } |
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 class HttpTest | |
| { | |
| private static HttpContext httpContext; | |
| private static HttpWorkerRequest httpWorkerRequest; | |
| private static StringBuilder outputStringBuilder; | |
| private static TextWriter output; | |
| private static NameValueCollection httpHeaders; | |
| private static HttpCookieCollection requestCookies; | |
| private static HttpCookieCollection responseCookies; |
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 DBTest : IDisposable | |
| { | |
| private DataContext dataContext; | |
| public DBTest() | |
| { | |
| dataContext = new DataContext(); | |
| } | |
| public void Dispose() |
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 NHibernateSessionManager | |
| { | |
| private const string CONNECTION_STRING_NAME = "..."; | |
| private static Configuration configuration; | |
| private static readonly ILog log; | |
| private static ISessionFactory sessionFactory; | |
| static NHibernateSessionManager() | |
| { |
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
| // There are three times when I will openly use static methods in C#. | |
| // 1. Providers | |
| // 2. State Machines (variation on provider, really) | |
| // 3. Any time where there *really* is *one* of something. | |
| /// <summary> | |
| /// 1. Providers give you a way to create new objects without using a constructor. Ideally, you would always | |
| /// use Dependency Injection and Inversion of Control. However, these techniques do not work in all situations, | |
| /// so we need a testable fallback. Providers fill this need. |
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 abstract class HttpSession : IHttpSession | |
| { | |
| protected IKeyValueStore storage; | |
| public virtual int UserId | |
| { | |
| get { return Get<int>("user_id"); } | |
| set { storage["user_id"] = value; } | |
| } | |
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
| class X | |
| def do_something | |
| '**PUBLIC**' | |
| end | |
| private | |
| def do_something_privately | |
| '--private--' | |
| end |
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
| module A | |
| def do_something | |
| puts "In A" | |
| end | |
| end | |
| module B | |
| def do_something_else | |
| puts "In B" | |
| end |