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 / 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 / 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 / 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 / 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 / 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 / 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 / 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 / queue-service.js
Created September 17, 2015 15:05
An angular service providing a simple queue
(function(){
var app = angular.module('mcbQueue', [])
.service('queue', [Queue]);
/**
* Queue.js
*
* A function to represent a queue
*
@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,
'use strict';
(function() {
angular
.module('mcbPersist', [])
.service('persist', ['$q', persistService]);
function persistService($q) {
var persist = this;
this.getDb = function() {
if (this.db === undefined) {