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: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: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: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: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: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: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 / create.sql
Created May 30, 2012 03:08
SqlServer Script
--Employees
CREATE TABLE Employees(
Id int not null,
LastName nvarchar(50) not null,
MiddleName nvarchar(50),
FirstName nvarchar(50) not null,
primary key(Id)
)
GO
@brianium
brianium / dynamictypes.cs
Created May 30, 2012 13:34
Creating Dynamic Generic Types in C#
void Main()
{
var genericType = typeof(GenericClass<>);
Type[] t = { typeof(int) };
var toCreate = genericType.MakeGenericType(t);
object o = Activator.CreateInstance(toCreate, "brian", "scaturro");
o.Dump();
}
class GenericClass<T>
@brianium
brianium / gist:2859761
Created June 2, 2012 19:59
sermon query for custom wordpress
SELECT DISTINCT p.ID
FROM wp_posts p
LEFT JOIN wp_term_relationships tr ON tr.object_id = p.ID
LEFT JOIN wp_term_taxonomy tt ON tr.term_taxonomy_id = tt.term_id
LEFT JOIN wp_terms t ON tt.term_id = t.term_id
WHERE p.post_type = "sermon"
AND p.post_status = "publish"
ORDER BY p.ID ASC
@brianium
brianium / gist:2934077
Created June 15, 2012 01:19
sample Wulib
(function(exports, undefined){
var Wulib = {},
activeDoc = app.activeDocument;
var ArtBoard = function(board) {
this.board = board;
};
ArtBoard.prototype = {
addPadding:function(val) {