Skip to content

Instantly share code, notes, and snippets.

View mgroves's full-sized avatar

Matthew D. Groves mgroves

View GitHub Profile
public class AjaxController : Controller
{
readonly IDatabase _db;
public AjaxController(IDatabase db)
{
_db = db;
}
// ... snip ...
using System.Data;
using System.Linq;
using Dapper;
using Ledger.Models.Entities;
namespace Ledger.Models.CommandQuery.Ledgers
{
public class GetLedgerByIdQuery : IQuery<LedgerEntity>
{
long id;
using System.Data;
using Dapper;
using Ledger.Models.Entities;
namespace Ledger.Models.CommandQuery.Ledgers
{
public class CreateLedgerCommand : ICommand
{
readonly LedgerEntity ledger;
using System.Data;
namespace Ledger.Models
{
public class Database : IDatabase
{
readonly IDbConnection _db;
public Database(IDbConnection db)
{
with Text_IO;
procedure Hello_World is
begin
Text_IO.Put_line("Hello World!");
end Hello_World;
<%
dim myXml 'assume that this is populate with an XML string
dim oXml
Set oXml = Server.CreateObject("MSXML2.DOMDocument.6.0") 'don't forget to use Set
oXml.LoadXML(myXml)
dim node
Set node = oXml.selectSingleNode("//@ShoeSize") 'don't forget to use Set
response.write "Shoe Size: " & node.text & "<br />" 'outputs: "Shoe Size: 13<br />"
<USER_INFO ShoeSize="13" FirstName="Matthew" LastName="Groves" City="Funkytown, USA" />
<%
'assume there's an HTTP header "someid: value"
dim someId
someId = Request.ServerVariables ("HTTP_someid")
response.write "someId: " & someId 'this outputs "someId: value"
response.end
%>
<%
'assume there's an HTTP header "some_id: value"
dim someId
someId = Request.ServerVariables ("HTTP_some_id")
response.write "someId: " & someId 'this outputs "someId:" NOT "someId: value"
response.end
%>
<script src="~/Scripts/jquery.js" type="text/javascript"></script>
<script src="~/Scripts/doT.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
var template = $("#my-dot-template");
var dotted = doT.template(template.html());
// I'm building up an object here with literals
// but typically this data would be returned by an ajax request
var data = {};