Skip to content

Instantly share code, notes, and snippets.

View jbnv's full-sized avatar
🙂
Life is good.

Jay Bienvenu jbnv

🙂
Life is good.
View GitHub Profile
@jbnv
jbnv / define.js
Last active September 3, 2015 21:09
A basic Durandal application. Based on content from http://www.infoq.com/articles/durandal-javascript-framework.
// All code in Durandal is written in modules and takes the following form:
define(function (require) {
var someModule = require('some-module');
//TODO ...other modules required here...
return someValue;
});
@jbnv
jbnv / index.html
Created September 3, 2015 21:01
Example of master/detail in Durandal. From Durandal's HTML Samples download.
<section>
<h1>Master / Detail</h1>
<form class="form-inline" role="form">
<div class="form-group">
<label class="control-label">Project</label>
</div>
<div class="form-group">
<select class="form-control" data-bind="options: projects, optionsText: 'name', value: activeProject"></select>
</div>
@jbnv
jbnv / index.html
Last active September 3, 2015 20:58
Example of publish and subscribe in Durandal. From Durandal's HTML Samples download.
<section>
<div class="col-md-6" data-bind="compose: publisher"></div>
<div class="col-md-6" data-bind="compose: subscriber"></div>
</section>
@jbnv
jbnv / DatabaseReader.vb
Last active September 3, 2015 20:50
Database utility classes for Visual Basic.net
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
''' <summary>
''' A class that facilitates reading data from a database into obhjects of arbirtrary classes.
''' </summary>
Public Class DatabaseReader
@jbnv
jbnv / ddmenu.html
Last active August 27, 2015 14:58
Dropdown Menu Bar/Ribbon in Bootstrap
<nav class="main-nav dropdown">
<ul class="list-inline">
<li id="liSort">
<button class="btn btn-link" data-toggle="dropdown">
<i class="fa fa-sort-amount-asc"></i>
<span class="hidden-xs">Sort</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="liSort">
<li role="presentation"><a role="menuitem" tabindex="-1">Sort Option 1</a></li>
@jbnv
jbnv / JSDecoratorPattern.js
Created August 18, 2015 15:44
JavaScript Decorator Pattern
var Thing = function() {
console.log('Assemble this thing.');
}
// The decorators will also need to implement these functions to comply with Thing's interface.
Thing.prototype = {
actionFunction: function() {
console.log('actionFunction');
},
valueFunction: function() {
@jbnv
jbnv / business-plan-template.md
Created August 15, 2015 13:41
Template for a business plan.

Executive Summary

This is a snapshot of your business plan as a whole and touches on your company profile and goals.

Company Description

Provides information on what you do, what differentiates your business from others, and the markets your business serves.

Market Analysis

@jbnv
jbnv / Revertable
Created July 8, 2015 23:36
Revertable class (VB)
Public Class Revertable(Of T)
private _value as T
private _oldValue as T
private _hasChanged as Boolean = false
public property Value as T
get
return _value
end get
@jbnv
jbnv / YearsView
Created July 8, 2015 23:26
Years view (SQL)
select n1000.n+n10.n*10+n1.n
from (select n=1900 union select 2000) n1000
cross join dbo.Numbers n10
cross join dbo.Numbers n1
--where n1000.n+n10.n*10+n1.n between 1900 and 2099
@jbnv
jbnv / MaxPK
Last active August 29, 2015 14:24
Get the maximum value of the primary key of each table in a database. (SQL Server)
-- This query generates another query which you will then run to get the maximum IDs.
SELECT STUFF((
SELECT 'UNION SELECT '''+TABLE_SCHEMA+''' AS TABLE_SCHEMA,'''+TABLE_NAME+''' AS TABLE_NAME,'''+COLUMN_NAME+''' AS COLUMN_NAME,'
+'CAST(MAX(['+COLUMN_NAME+']) AS VARCHAR) FROM ['+TABLE_SCHEMA+'].['+TABLE_NAME+'] AS [MaxPrimaryKeyValue] '
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE OBJECTPROPERTY(OBJECT_ID(constraint_name), 'IsPrimaryKey') = 1
ORDER BY TABLE_SCHEMA,TABLE_NAME
FOR XML PATH('')
),1,6,'') + 'ORDER BY TABLE_SCHEMA,TABLE_NAME'