Skip to content

Instantly share code, notes, and snippets.

View matthewbednarski's full-sized avatar

Matthew Bednarski matthewbednarski

  • Barbarano Vicentino (VI), Italy
View GitHub Profile
@matthewbednarski
matthewbednarski / globals-service.js
Created September 17, 2015 15:08
provides injectable versions of lodash and moment global variables
(function(){
var app = angular.module('mcbGlobals', [])
.service('lodash', [Lodash])
.service('moment', [Moment]);
function Lodash() {
return window._;
}
@matthewbednarski
matthewbednarski / AppContext.java
Created September 24, 2015 10:36
gives access to the ApplicationContext
package it.solinfo.xdsindexer.utils;
import org.apache.log4j.Logger;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import javax.inject.Named;
/**
@matthewbednarski
matthewbednarski / spinner-directive.js
Created September 24, 2015 12:56
A bootstap modal with a spinner
(function() {
var app = angular.module('mcbSpin', [])
.directive('spinner', [Spinner]);
function Spinner() {
return {
restrict: 'EA', //E = element, A = attribute, C = class, M = comment
scope: {
//@ reads the attribute value, = provides two-way binding, & works with functions
show: '@',
@matthewbednarski
matthewbednarski / app.js
Last active September 24, 2015 15:05
datepicker-directive.js
(function() {
var app = angular.module('app', [ 'siDate'])
.service('datePickerConfig', ['$document', datePickerConfig]);
function datePickerConfig($document) {
var defaults = {
autoclose: true,
beforeShowDay: $.noop,
calendarWeeks: true,
clearBtn: false,
@matthewbednarski
matthewbednarski / tree-directive.js
Created September 30, 2015 07:43
an angular 1.x directive for bootstrap-treeview
(function($) {
/**
* A [bootstrap-treeview](https://github.com/jonmiles/bootstrap-treeview) directive.
*
* requires:
* bootstrap-treeview: v 1.2.0
*
*/
@matthewbednarski
matthewbednarski / smart-table.js
Created September 30, 2015 09:06
an updated version of the 2.1.3 version of angular Smart Table allowing for the swapping out of many similar sized arras
/**
* @version 2.1.3
* @license MIT
*/
(function(ng, undefined) {
'use strict';
ng.module('smart-table', []).run(['$templateCache',
function($templateCache) {
$templateCache.put('template/smart-table/pagination.html',
@matthewbednarski
matthewbednarski / focus-directive.js
Last active September 30, 2015 14:55
a directive to give focus to an element, adds tabindex if the element doesn't already have it
(function() {
var app = angular.module('mcbFocus', [])
.directive('focusOn', function() {
return function(scope, elem, attr) {
if(attr.tabIndex === undefined){
elem.attr('tabindex', -1);
}
scope.$on('focusOn', function(e, name) {
if (name === attr.focusOn) {
elem[0].focus();
@matthewbednarski
matthewbednarski / spinner-directive.js
Created October 1, 2015 07:32
a spinner directive using bootstrap modal and font-awesome fonts
(function() {
var app = angular.module('mcbSpin', [])
.directive('spinner', [Spinner]);
function Spinner() {
return {
restrict: 'EA', //E = element, A = attribute, C = class, M = comment
scope: {
//@ reads the attribute value, = provides two-way binding, & works with functions
show: '@',
@matthewbednarski
matthewbednarski / datepicker-directive.js
Created October 1, 2015 14:20
A bootstrap-datepicker angular directive
(function($) {
var app = angular.module("siDate", [])
.directive('datePicker', [datePicker]);
function datePicker() {
return {
restrict: 'EA', //E = element, A = attribute, C = class, M = comment
replace: true,
scope: {
@matthewbednarski
matthewbednarski / datepicker-directive.js
Created October 1, 2015 14:21
A bootstrap-datepicker angular directive
(function() {
var app = angular.module("siDate", [])
.directive('datePicker', [datePicker]);
function datePicker() {
return {
restrict: 'EA', //E = element, A = attribute, C = class, M = comment
replace: true,
scope: {