Skip to content

Instantly share code, notes, and snippets.

View burkeholland's full-sized avatar

Burke Holland burkeholland

  • Microsoft
  • Franklin, TN
View GitHub Profile
var assembly = Assembly.GetCallingAssembly();
var instance = assembly.CreateInstance("MyProject.MyClass", true,
BindingFlags.CreateInstance, null, new object[]
{ monitor, action }, null, null);
var t = instance.GetType();
// if you have a property you want to pass
// a value to, this is how you do it.
var p = t.GetProperty("MyProperty");
@burkeholland
burkeholland / Monarchy.cs
Created July 23, 2011 01:18 — forked from derekgreer/Monarchy.cs
Monarchy Refactored
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Monarchy
{
public class ObjectFactory {
static readonly IDictionary<Type, Func<object>> Container = new Dictionary<Type, Func<object>>();
static readonly MethodInfo CreateObjectMethodInfo = typeof (ObjectFactory).GetMethod("Get");
@burkeholland
burkeholland / MonarchySpecs.cs
Created July 23, 2011 01:19 — forked from derekgreer/MonarchySpecs.cs
Monarchy Refactored Specs
using Machine.Specifications;
namespace Monarchy.Specs
{
[Subject(typeof (ObjectFactory))]
public class when_retrieving_a_type_with_registered_dependency_factory
{
static TestService _instance;
static ObjectFactory _factory;
@burkeholland
burkeholland / Monarchy.cs
Created July 23, 2011 01:20 — forked from derekgreer/Monarchy.cs
Monarchy Refactored
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Monarchy
{
public class ObjectFactory {
static readonly IDictionary<Type, Func<object>> Container = new Dictionary<Type, Func<object>>();
static readonly MethodInfo CreateObjectMethodInfo = typeof (ObjectFactory).GetMethod("Get");
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Monarchy {
public class ObjectFactory {
static readonly IDictionary<Type, object> Container = new Dictionary<Type, object>();
public static T Get<T>() {
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
<table>
<tr>
<td>First Name:</td>
<td>#{txtFirstName}#</td>
[ToolboxItemAttribute(false)]
public class HelloWorldWebPart : WebPart {
TextBox _firstName;
TextBox _lastName;
Button _sayHello;
Label _result;
protected override void CreateChildControls() {
_firstName = new TextBox() { ID = "txtFirstName" };
protected override void Render(HtmlTextWriter writer) {
var canvas = new Canvas(SPContext.Current.Web.Url + "/_layouts/HelloWorld/canvas.htm");
string html = canvas.Render(this);
writer.Write(html);
}
{
"name": "Elijah's Brain",
"version": "1.2",
"description": "Tech tweets directly from the brain of Elijah Manor.",
"browser_action": {
"default_icon": "icon16.png",
"popup": "popup.html"
},
"icons": {
"16": "icon16.png",
<script>
$.getJSON('https://api.twitter.com/1/statuses/user_timeline.json?screen_name=elijahmanor&count=50&exclude_replies=true&trim_user=true', function(data) {
console.log(data);
});
</script>