Skip to content

Instantly share code, notes, and snippets.

View brianium's full-sized avatar
🕊️
Human

Brian Scaturro brianium

🕊️
Human
View GitHub Profile
@brianium
brianium / gist:2241287
Created March 29, 2012 18:10
sample aspx for web forms mvp
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="PageView.aspx.cs" Inherits="BissellMVPTest.Web.PageView" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h2>New Post</h2>
<asp:Panel ID="savePanel" Visible="<%# isVisible %>" runat="server">
<p>
Title: <%# Model.Title %>
</p>
@brianium
brianium / gist:2240759
Created March 29, 2012 17:51
sample event args used in web forms mvp
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BissellMVPTest.BLL.Views.EventArguments
{
public class BlogPostArgs : EventArgs
{
public string PostTitle { get; set; }
@brianium
brianium / gist:2240680
Created March 29, 2012 17:47
sample presenter in web forms mvp
using System;
using System.Collections.Generic;
using System.Linq;
using WebFormsMvp;
using BissellMVPTest.BLL.Views.Models;
using BissellMVPTest.BLL.Views;
using BissellMVPTest.BLL.Views.EventArguments;
@brianium
brianium / gist:2240668
Created March 29, 2012 17:46
code behind sample using web forms mvp
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebFormsMvp;
using WebFormsMvp.Web;
@brianium
brianium / gist:2218442
Created March 27, 2012 17:59
meta example with key codes
var KeyMap = {
"Enter":13,
"Shift":16,
"Tab":9,
"LeftArrow":37
};
for (var key in KeyMap) {
KeyMap["is" + key] = function(compare,ev) {
return ev.keyCode == compare
@brianium
brianium / gist:2160704
Created March 22, 2012 17:41
using WCF serialized dates in JavaScript
String.prototype.DateWCF = function () {
var d = new Date(parseInt(this.substr(6)));
return (d.getUTCMonth() + 1) + '/' + d.getUTCDate();
};
//usage
var option = //some shipping option object returned from a RESTful WCF service
option.DeliveryEnd.DateWCF()
@brianium
brianium / gist:2150452
Created March 21, 2012 18:05
JavaScript AOP proof of concept
//AOP powers rely on invoke() being used instead of ()
Function.prototype.invoke = function(args) {
if (this.before) {
this.before(args);
}
val = this(args);
if (this.after) {
this.after(args);
}
return val;
@brianium
brianium / gist:2128767
Created March 20, 2012 00:08
simple binary socket writer/reader
<?php
namespace Infrastructure\BinarySocket;
class BinarySocket
{
protected $socket;
public function __construct($ip,$port)
{
$this->socket = @socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
$connected = @socket_connect($this->socket,$ip,$port);
@brianium
brianium / gist:2052706
Created March 16, 2012 21:07
related model
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DMSSubscriberUpdate.Domain
{
public class Attempt
{
public int ChannelID { get; set; }
@brianium
brianium / gist:2052663
Created March 16, 2012 21:01
domain service
using System;
using System.Collections.Generic;
using System.Linq;
namespace DMSSubscriberUpdate.Domain.Services
{
class SubscriberProcessor
{
protected Subscriber Subscriber { get; set; }