Skip to content

Instantly share code, notes, and snippets.

View douglas-mason's full-sized avatar

Douglas Mason douglas-mason

View GitHub Profile
@douglas-mason
douglas-mason / default.aspx.cs
Created April 20, 2012 13:52
Public property to set doctype in master page.
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
master_pages_core master = (master_pages_core)this.Master;
master.DocType = "<!DOCTYPE html>";
}
}

Bearded's Hourly Contract

Date: [[Date of Document]] Between [Our Company] and [Your Company]

Summary

We’re not big on formality, but sometimes it’s best to have a few simple things written down so that we’re all on the same page. In this contract you won’t find complicated legal terms or large passages of unreadable text. We have no desire to trick you into signing something that you might later regret. We do want what’s best for the safety of both parties, now and in the future.

@douglas-mason
douglas-mason / FizzBuzz.rb
Last active December 21, 2015 08:59
FizzBuzz in Ruby
class FizzBuzz
def fizz_buzz_puts(number)
fb_string = ''
if number%3 == 0
fb_string += 'Fizz'
end
if number%5 == 0
fb_string += 'buzz'
end
fb_string = number if fb_string ==''
@douglas-mason
douglas-mason / SiteMapTraverser.cs
Created November 13, 2013 19:55
Grabs value of specified attribute from a site map node. If recursive search is specified, then search up the site map tree for the next ancestor node that contains a value for the specified attribute.
public static string GetNodeAttributeValue(SiteMapNode currentNode, string attributeName, bool recursive)
{
if (recursive) // Do recursive search
{
string attributeValue = "";
if (currentNode != null)
{
attributeValue = GetNodeAttributeValue(currentNode, attributeName, false); // Search node currently working with.
if (string.IsNullOrEmpty(attributeValue)) // If attribute not found, then check the parent node.
{
@douglas-mason
douglas-mason / Better If
Last active August 29, 2015 13:55
Readability Tip #1
var myCar = new Car({color: 'black', style: 'Police Car'});
var theirCar = new Car({color: 'red', style: 'Sports Car'});
var isRedSportsCar = theirCar.color === 'red' && theirCar.style === 'Sports Car';
if(isRedSportsCar){
myCar.chase(theirCar);
}
@douglas-mason
douglas-mason / nconfig-setup-notes.md
Last active August 29, 2015 13:56
NConfig setup notes for webforms projects

###Configuring NConfig for webforms

  1. Install the nuget package
  2. Add Config folder and custom config file (ex: mycomputername.custom.config)
  3. Add NConfigurator code to global.asax - Example
    NConfigurator.UsingFiles("Config\\Custom.config", "Config\\Connections.config").SetAsSystemDefault();
  4. Make sure your virtual path for the web project is "/" and not "/web", unless you fix the path that NConfig uses
  5. If the application hangs when you try to run it, restart IIS
@douglas-mason
douglas-mason / 0_reuse_code.js
Created March 10, 2014 17:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@douglas-mason
douglas-mason / readme.md
Created March 3, 2017 04:50
20170302-CL-Weekly-Gist Top Picks of the Week