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 / single-select-directive.js
Created September 9, 2015 15:57
a directive to show a single available item as a text box
(function() {
var app = angular.module('mcbSingleSelect', [])
.directive('singleSelect', [singleSelectDirective]);
function singleSelectDirective() {
return {
restrict: 'EA', //E = element, A = attribute, C = class, M = comment
scope: {
//@ reads the attribute value, = provides two-way binding, & works with functions
optionsList: '=?',
@matthewbednarski
matthewbednarski / index.html
Created September 3, 2015 15:45
index.html
<!DOCTYPE html>
<html manifest="manifest.appcache">
<head>
<link href="css/custom.css" rel="stylesheet" type="text/css" />
<link href="libs/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" /> <script src="libs/lodash.js/3.10.1/lodash.min.js"></script> <script src="libs/jquery/2.1.4/jquery.min.js"></script>
<script src="libs/angular.js/1.3.18/angular.min.js"></script>
<script src="libs/moment.js/2.10.3/moment-with-locales.min.js"></script>
<script src="libs/bootstrap-datepicker/1.4.0/js/bootstrap-datepicker.min.js"></script>
<link href="libs/bootstrap-datepicker/1.4.0/css/bootstrap-datepicker.min.css" rel="stylesheet" type="text/css" />
<link href="libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
@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: {
@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 / 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 / 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 / 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 / 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 / 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 / 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