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 / SpringBootNoDispatcherServlet.java
Created August 26, 2015 07:22
An example Spring Boot Application which turns off the default Spring DispatcherServlet
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
/**
SpringBootNoDispatcherServlet.java SpringBootServletRegistrationOverrides.java Created by matthew.bednarski on 19/06/2015.
*/
@SpringBootApplication(exclude = { DispatcherServletAutoConfiguration.class })
public class Application {
@matthewbednarski
matthewbednarski / binary-content.js
Created August 26, 2015 12:42
An example implementation for downloading and viewing a pdf in an AngularJS app
(function() {
var app = angular
.module('app',[])
.controller('MyController', ['$q', '$sce', 'myService', Controller])
.service('myService', ['$q', '$http', Service]);
function Controller($scope, $q, $sce, service) {
var ctl = this;
this.download = function(doc) {
service.downloadDoc(doc, ctl.x_auth)
@matthewbednarski
matthewbednarski / source_MAVEN_OPTS
Created August 26, 2015 15:34
A shell script to be sourced for re/setting the jmx and java debug options passed to maven
#!/bin/bash
if [[ "" == "$1" ]] && [[ "" == "$2" ]]; then
jmx=9010
debug=8787
elif [[ "" == "$2" ]]; then
jmx=$1
debug=8787
else
jmx=$1
@matthewbednarski
matthewbednarski / cf-filter.js
Last active August 31, 2015 14:29
An angular filter for validating Italian Codici Fiscali
(function() {
var app = angular.module('cf', [])
.filter('isCodiceFiscale', [codiceFiscale]);
/**
* taken from https://gist.github.com/TheHiddenHaku/6951634
*
* A function for evaluating if a string is a valid codice fiscale
*
* @param String codiceFiscale
@matthewbednarski
matthewbednarski / pandoc2redmine.sh
Created September 1, 2015 09:01
A bash script using sed to clean up pandoc's textile output for use with Redmine
#!/bin/bash
dir=$(dirname "${BASH_SOURCE[0]}")
# requires pandoc and sed
# example usage
# ./pandoc2redmine.sh README.md output.Redmine.textile
#
in=$1
@matthewbednarski
matthewbednarski / colored-echo.sh
Created September 1, 2015 15:13
An example of how to color echo's output in bash
#!/bin/bash
####
#
#
# http://misc.flogisoft.com/bash/tip_colors_and_formatting
#
#
####
echo-blue () {
@matthewbednarski
matthewbednarski / cdnjs-client.json
Last active September 3, 2015 14:14
a very ( too ) simple javascript libs manager
{
"cloudflare": {
"root": "https://cdnjs.cloudflare.com/ajax/libs",
"relative-location" : "src/main/webapp/libs",
"dependencies": {
"font-awesome": {
"version": "4.4.0",
"css": [
"font-awesome.min.css"
],
@matthewbednarski
matthewbednarski / cdnjs-client
Last active February 20, 2016 13:29
a very ( too ) simple javascript libs manager
#!/bin/bash
##########
#
# parameters:
# conf: (required) points a cdnjs-client.json file; eg. [cdnjs-client.json](https://gist.github.com/matthewbednarski/30dd4b65221a8c8c67ee)
#
# requires: jq, wget
#
##########
@matthewbednarski
matthewbednarski / find-and-edit
Last active September 3, 2015 15:15
tries to find and edit a file in vim; list's all matching files but only edits the first
#!/bin/bash
dir=$(dirname "${BASH_SOURCE[0]}")
find -wholename "*${1}"
find -wholename "*${1}" -exec vim '{}' \; -quit
@matthewbednarski
matthewbednarski / app.js
Created September 3, 2015 15:44
js/app.js
(function() {
var app = angular.module('app', ['smart-table', 'cf', 'user']);
app
.controller('Cont', ['$scope', '$q', '$location', '$window', '$sce', 'service', '$filter', 'user', ControllerMethod])
.service = app.service('service', ['$q', '$http', Service])
.directive('iframeOnload', [
function() {
return {
scope: {