Skip to content

Instantly share code, notes, and snippets.

View justintoth's full-sized avatar

Justin Toth justintoth

View GitHub Profile
function mapJobListViewModel(details) {
var self = this;
this.entity;
this.views;
this.jobFormViewModel;
this.init = function () {
$('#job-date-range').change(function () {
self.get();
});
function mapJobFormViewModel(list) {
var self = new baseFormViewModel('job', list);
self.entity;
self.init = function () {
self.baseInit();
//setup datetime pickers.
$('#expectedArrivalDate').datetimepicker({
dateFormat: 'm/d/yy',
function baseFormViewModel(entityName, list) {
var self = this;
this.baseInit = function () {
//set default values.
self.clear();
ko.applyBindings(self, $('#' + entityName + '-form-container')[0]);
//setup ajax form.
utils.setupForm(function (e) {
function bindCategories(data) {
//ko.mapping.fromJS(data, mappingOptions, viewModel.cannedResponseCategoriesViewModel);
viewModel.cannedResponseCategoriesViewModel = ko.mapping.fromJS(data, mapping);
vjq.each(viewModel.cannedResponseCategoriesViewModel(), function (index, item) {
item.Label.subscribe(function (value) {
alert('subscribed');
Velaro.PremadeCategory.Update(ko.toJS(item));
});
subscribeInnerElements(item.Children);
@justintoth
justintoth / CenteredButtonDrawable.cs
Created September 17, 2014 17:28
Xamarin - Center Button Text + Left Drawable
public class CenteredButtonDrawable : Button {
private static int LEFT = 0, TOP = 1, RIGHT = 2, BOTTOM = 3;
// Pre-allocate objects for layout measuring
private Rect textBounds = new Rect();
private Rect drawableBounds = new Rect();
public CenteredButtonDrawable(Context context) : base(context, null) {
}
@justintoth
justintoth / gist:1860367
Created February 18, 2012 17:50
Android Error Log
I/InputReader( 312): dispatchTouch::touch event's action is 0, pending(waiting finished signal)=0
I/InputDispatcher( 312): Delivering touch to current input target: action: 0, channel '4381ba68 com.navtrak.driver/com.navtrak.driver.DriverActivity (server)'
I/InputDispatcher( 312): Delivering touch to current input target: action: 0, channel 'TouchIntercepter (server)'
I/InputReader( 312): dispatchTouch::touch event's action is 1, pending(waiting finished signal)=0
I/InputDispatcher( 312): Delivering touch to current input target: action: 1, channel '4381ba68 com.navtrak.driver/com.navtrak.driver.DriverActivity (server)'
I/InputDispatcher( 312): Delivering touch to current input target: action: 1, channel 'TouchIntercepter (server)'
I/AudioFlinger( 240): start output streamType (0, 1) for 1
I/AudioFlinger( 240): stop output streamType (0, 1) for 1
I/InputReader( 312): dispatchTouch::touch event's action is 0, pending(waiting finished signal)=0
I/InputDispatcher( 312): Delivering touch to current inpu
@justintoth
justintoth / gist:2003157
Created March 8, 2012 20:15
UserUpdate
{
"_id" : {
"DeviceId" : NumberLong("4128023241"),
"UserId" : 1
},
"IpAddressNumber" : NumberLong(255217216),
"Icon" : "#c23c3c/0",
"IconWeight" : 55,
"IconAlertId" : 39018,
"IconEventId" : 40,
public class UserView
{
public UserView()
{
}
public UserView(Models.Users.User.User user)
{
Id = user.Id;
FirstName = user.FirstName;
@justintoth
justintoth / RBA_Get_PermissionsByRole.sql
Created March 12, 2012 18:54
RBA_Get_PermissionsByRole
CREATE PROCEDURE [dbo].[RBA_Get_PermissionsByRole]
@RoleId INT
AS
BEGIN
SET NOCOUNT ON;
SELECT p.id as PermissionId, p.Name, p.[key] as [Key], parent.[key] as ParentKey, p.MaxBits, p.MinBits, rp.PermissionBit, dp.[key] as [Dependency]
FROM role_permission rp WITH (NOLOCK)
JOIN permission p WITH (NOLOCK) ON rp.permissionid = p.id
LEFT JOIN permission parent WITH (NOLOCK) ON p.parentid = parent.id
@justintoth
justintoth / form.htm
Created March 12, 2012 20:41
Keyfob Submit
<form action="http://localhost/NavtrakAPI/api/peripherals/create/?authUserId=37853&authGuid=4cc1afa9-12f6-47da-af48-3103c56311dc" method="post">
<div>
Name: <input name="peripheral.Name" value="@Model.Name" />
</div>
<br />
<div>
Serial Number: <input name="peripheral.SerialNumber" value="@Model.SerialNumber" />
</div>