Skip to content

Instantly share code, notes, and snippets.

@srkirkland
srkirkland / Heartbeat.html
Created August 19, 2011 18:49
JavaScript Heartbeat function
<script>
setInterval(function () {
$.get("/", null, function () {});
}, 10000);
</script>
@srkirkland
srkirkland / template.js
Created September 1, 2011 17:34
Template for creating componentized javascript design
(function (purchasing, $) {
//Private Property
var options = {};
//Public Property
purchasing.AddressData = { Id: null, Name: 'Default' };
//Public Method
purchasing.options = function (o) {
$.extend(options, o);
@srkirkland
srkirkland / subaccounts.sql
Created October 7, 2011 17:36
Sub accounts query for inserting into db
SELECT *,
'new { account = "'+CHART_NUM+'-'+ACCT_NUM+'", subaccount = "'+SUB_ACCT_NUM+'", name = "'+SUB_ACCT_NAME+'"},'
FROM OPENQUERY(FIS_DS_PROD, '
SELECT CHART_NUM
,ACCT_NUM
,SUB_ACCT_NUM
,ACCT_NAME
,SUB_ACCT_NAME
FROM FINANCE.SUB_ACCOUNT
WHERE CHART_NUM = ''3'' AND FISCAL_YEAR = 9999 AND FISCAL_PERIOD = ''--''
@srkirkland
srkirkland / order.js
Created December 21, 2011 23:25
new version of line item validation
purchasing.validateLineItem = function () {
$(".line-item-row").each(function () {
var row = $(this);
var hasQuantity = purchasing.cleanNumber(row.find(".quantity").val()) !== '';
var hasPrice = purchasing.cleanNumber(row.find(".price").val()) !== '';
var hasDescription = row.find(".description").val().trim() !== '';
if (hasQuantity || hasPrice || hasDescription) {
row.find(".quantity").toggleClass("line-item-ok", hasQuantity).toggleClass("line-item-warning", !hasQuantity);
row.find(".description").toggleClass("line-item-ok", hasDescription).toggleClass("line-item-warning", !hasDescription);
@srkirkland
srkirkland / RegisterClientValidationExtensions.vb
Created March 7, 2012 03:10
VB.NET version of Data Annotations Extensions Validation Registration Code
Imports DataAnnotationsExtensions.ClientValidation
<Assembly: WebActivator.PreApplicationStartMethod(GetType(App_Start.RegisterClientValidationExtensions), "Start")>
Namespace App_Start
Public NotInheritable Class RegisterClientValidationExtensions
Private Sub New()
End Sub
Public Shared Sub Start()
DataAnnotationsModelValidatorProviderExtensions.RegisterValidationExtensions()
@srkirkland
srkirkland / global.asax.vb
Created March 8, 2012 05:35
data annotations extensions global.asax in vb
Imports DataAnnotationsExtensions.ClientValidation
Public Class MvcApplication
Inherits System.Web.HttpApplication
Shared Sub RegisterGlobalFilters(ByVal filters As GlobalFilterCollection)
filters.Add(New HandleErrorAttribute())
End Sub
Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
public ActionResult Users()
{
var users =
_repositoryFactory.UserRepository.Queryable.Where(
x => x.Id == "pgang" || x.Id == "anlai" || x.Id == "postit").ToList();
return Content(WriteUsers(users), "text/plain");
}
<script src="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Scripts/js")"></script>
<link href="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Content/css")" rel="stylesheet" type="text/css" />
## Creating a branch and working on a remote branch
git checkout -b superfunbranchname
## This puts you onto a new branch with the given name
## Do work, commit changes, etc.
git push origin superfunbranchname
## This pushed your branch so others can get to that code
$.getJSON(url, { id: orderId, orderStatusCodeId: role }, function (result) {
var ul = $("#myul");
$(result).each(function(){
ul.append($("<li>").text(this));
});
});