Skip to content

Instantly share code, notes, and snippets.

View michaeljacobdavis's full-sized avatar

Mike Davis michaeljacobdavis

View GitHub Profile
@michaeljacobdavis
michaeljacobdavis / Helper.cs
Created July 27, 2012 15:55
Unit testing methods for nested Fluent Validation properties
// Adapted from http://devio.wordpress.com/2011/01/21/get-name-of-nested-property-as-string-value/
public static string GetPropertyName<T, TValue>(this T model, Expression<Func<T, TValue>> expression) where T : class
{
var memberExpression = (MemberExpression)expression.Body;
var memberExpressionOrg = memberExpression;
var Path = "";
while (memberExpression != null && memberExpression.Expression.NodeType == ExpressionType.MemberAccess)
@michaeljacobdavis
michaeljacobdavis / Getting a Job.md
Last active March 25, 2018 21:13
Career Advice

Getting a Job

  • Checkout what's out there
    • What are employers looking for?
    • Checkout linkedin and see if you can get intros
    • See if they host open houses or events
  • Meetup
    • Network
    • Learn something know
    • Meet cool people!
  • Github
module.exports = {
hello: 'hello',
blah: 'blah',
default: 'default'
}
@michaeljacobdavis
michaeljacobdavis / Adapter.js
Created August 7, 2012 05:19
NotEqual Fluent Validation validator with client side validation
(function ($) {
$.validator.addMethod("notequal", function (value, element, param) {
return this.optional(element) || value != $(param).val();
}, "This has to be different...");
$.validator.unobtrusive.adapters.add("notequal", ["field"], function (options) {
options.rules["notequal"] = options.params.field;
if (options.message) options.messages["notequal"] = options.message;
});
})(jQuery);
defaults read > a
Open system preferences and change the setting to some other value than the default.
defaults read > b
Post diff a b here.
var RowActionsCell = ReactDataGridPlugins.Draggable.RowActionsCell;
var DraggableContainer = ReactDataGridPlugins.Draggable.Container;
var DropTargetRowContainer = ReactDataGridPlugins.Draggable.DropTargetRowContainer;
var Selectors = ReactDataGridPlugins.Data.Selectors;
var priorities = [{id:0, title : 'Critical'}, {id:1, title : 'High'}, {id:2, title : 'Medium'}, {id:3, title : 'Low'}]
var issueTypes = ['Bug', 'Improvement', 'Epic', 'Story'];
//helper to generate a random date
function randomDate(start, end) {

Requirements

  • Protect access to pages
  • Protect functionality

Questions

  • Can users have multiple roles? No
  • Are there custom permissions? No
  • Role inheritance? No
  • Server + client? Yes

Protected routes on the server. Protected routes on the client.

@michaeljacobdavis
michaeljacobdavis / setTimeout.js
Created February 29, 2016 23:20
What not to do
setTimeout(function () {
async.parallel(conditions, function (err) {
setTimeout(function () {
$('[lazo-cmp-container="lazo-layout-body"]').animate({
}, 500, function () {
setTimeout(function () {
}, 100);
});
}, 10);
});
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="http://localtodos.com/todos.css" />
</head>
<body>