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 / index.html
Created May 21, 2015 15:34
A simple bootstrap form with 2 bootstrap datepicker A simple bootstrap form with 2 bootstrap datepickers // source http://jsbin.com/nidewi
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="A simple bootstrap form with 2 bootstrap datepickers">
<script src="https://rawgit.com/lodash/lodash/3.0.1/lodash.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script>
<script src="https://code.jquery.com/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.0/js/bootstrap-datepicker.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.0/css/bootstrap-datepicker.min.css" rel="stylesheet" type="text/css" />
@matthewbednarski
matthewbednarski / index.html
Last active August 29, 2015 14:21
JS BinA simple bootstrap form with 2 bootstrap datepickers// source http://jsbin.com/nidewi
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="A simple bootstrap form with 2 bootstrap datepickers"/>
<meta name="gist-url" content="https://gist.github.com/matthewbednarski/a1da75343128c2036b98"/>
<meta name="jsbin-url" content="http://jsbin.com/nidewi"/>
<link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<script src="https://rawgit.com/lodash/lodash/3.0.1/lodash.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script>
// Enter a client ID for a web application from the Google Developer Console.
// The provided clientId will only work if the sample is run directly from
// https://google-api-javascript-client.googlecode.com/hg/samples/authSample.html
// In your Developer Console project, add a JavaScript origin that corresponds to the domain
// where you will be running the script.
var clientId =
'clientId';
// Enter the API key from the Google Develoepr Console - to handle any unauthenticated
// requests in the code.
@matthewbednarski
matthewbednarski / persist-service.js
Last active August 29, 2015 14:23
Angular local persistence service using PouchDB
'use strict';
/**
* uses PouchDB
*
* https://cdnjs.cloudflare.com/ajax/libs/pouchdb/3.6.0/pouchdb.js
* https://cdnjs.cloudflare.com/ajax/libs/pouchdb/3.6.0/pouchdb.min.js
*/
function Persistence($q) {
var persist = this;
@matthewbednarski
matthewbednarski / SecurityInitializer.java
Last active August 29, 2015 14:27
initializes Spring Security context
import configuration.SecurityConfig;
import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
/**
AppInitializer.java auth cli configuration controller entity eulero model repository scheduler SecurityInitializer.java service utils Created by matthewb on 8/5/15.
*/
public class SecurityInitializer extends AbstractSecurityWebApplicationInitializer {
protected Class<?>[] getRootConfigClasses(){
@matthewbednarski
matthewbednarski / SecurityConfig.java
Last active August 29, 2015 14:27
SecurityConfig.java an example Spring security configuration file
package configuration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
@matthewbednarski
matthewbednarski / gist
Created August 18, 2015 09:44
a script for publishing gists to github
#!/bin/sh
###########################################
#
# A script for publishing gists to github
#
# requires that you create a file ~/.github.token containing an personal access token for publishing gists (https://github.com/settings/tokens)
#
# usage:
# gist example.js all other parameters are concatenated for use as the description, other wise the filename is used as the description
@matthewbednarski
matthewbednarski / gist
Last active August 29, 2015 14:27
a script for publishing gists; depends on curl, python anad jq. it requires that the github authorization token be saved at ~/.github.gist.token
#!/bin/sh
###########################################
#
# A script for publishing gists to github
#
# requires that you create a file ~/.github.gist.token containing an personal access token for publishing gists (https://github.com/settings/tokens)
#
# usage:
# gist example.js all other parameters are concatenated for use as the description, other wise the filename is used as the description
@matthewbednarski
matthewbednarski / .remote-settings-parser
Created August 21, 2015 14:12
A shell script for remotely extracting and parsing xml files from zip archives (such as .jar/.war/.ear archives )
#!/bin/bash
##############
#
#
# Get applicationContext.xml
# depends: 7z, ssh
#
#
@matthewbednarski
matthewbednarski / uuid.js
Created August 22, 2015 14:52
a service for producing v4 uuids
(function() {
var app = angular.module('mcbUuid', [])
.service('uuid', [Uuid]);
// http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
//
function Uuid() {
this.newUuid = function() {
var d = new Date().getTime();
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {