Skip to content

Instantly share code, notes, and snippets.

View michaeljacobdavis's full-sized avatar

Mike Davis michaeljacobdavis

View GitHub Profile
function($http, $q) {
var cache = {};
return {
get: function (force){
var deferred = $q.defer();
if(force || !cache['get']){
return $http.get('/path/to/data').then(function(result){
@michaeljacobdavis
michaeljacobdavis / Gruntfile.js
Created September 29, 2014 19:54
Grunt Clean Up
module.exports = function(grunt) {
'use strict';
var _ = require('lodash');
// Configuration
// -------------
// Load Tasks
// ----------
it('waits for delete to return before saving', function(done){
// Given
var options = {
model: new Backbone.Model({
modules: new Backbone.Collection([
new Model(),
new Model()
])
}),
success: function(){}
@michaeljacobdavis
michaeljacobdavis / Questions.md
Last active August 29, 2015 14:19
Questions

Questions

  1. How good are you at foosball?
  2. What developer tools do you use and what are some things you like about them?
  3. Walk me through a Cross site scripting attack? Cross site request forgery?
  4. NPM? How does node resolve dependencies? require('foo');
  5. Walk me through binding a model to a text input?
  6. How do you learn a library?
  7. Whats the most recent one you've tried?
var d3 = require('d3');
var internals = {};
module.exports = function ($parse, $compile) {
return {
restrict: 'E',
replace: false,
scope: {
data: '=chartData',
width: '=width',
@michaeljacobdavis
michaeljacobdavis / Site.css
Created July 27, 2012 18:23
Adding groups (1 message for multiple properties) to MVC3's Validation
.input-validation-error
{
border: 1px solid #ff0000;
background-color: #ffeeee;
}
span.input-validation-error {
border: none;
}
(function ($) {
$.fn.formatfilename = function (options) {
var settings = $.extend({
'length': '40'
}, options);
return this.each(function () {
var $this = $(this);
$.fn.autotab = function () {
var inputEvents = "input";
if (!("oninput" in document || "oninput" in $("<input>")[0])) {
inputEvents += " keypress";
}
return this.each(function () {
var $this = $(this);
$this.on(inputEvents, "input[maxlength]", function (e) {
var $this = $(this);
if ($this.attr("maxlength") <= $(this).val().length) {
@michaeljacobdavis
michaeljacobdavis / inheritsFrom.js
Created December 13, 2012 00:33
inheritsFrom
Function.prototype.inheritsFrom = function (base) {
this.prototype = Object.create(base.prototype);
this.prototype.constructor = this;
this.prototype._super = base.prototype;
return this;
};
var Base = function () {
if (!(this instanceof Base))
throw ('Constructor called without "new"');
@michaeljacobdavis
michaeljacobdavis / Post-build event
Created February 9, 2013 06:20
R.js Minification on TFS build and Publish
cd "$(ProjectDir)Scripts"
node.exe r.js -o build.js