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 / postal-codes.json
Last active May 25, 2023 12:38
Global postal codes regex formats
[{ "Note": "The first two digits (ranging from 10–43) correspond to the province, while the last two digits correspond either to the city/delivery zone (range 01–50) or to the district/delivery zone (range 51–99). Afghanistan Postal code lookup", "Country": "Afghanistan", "ISO": "AF", "Format": "NNNN", "Regex": "^\\d{4}$"}, { "Note": "With Finland, first two numbers are 22.", "Country": "Åland Islands", "ISO": "AX", "Format": "NNNNN", "Regex": "^\\d{5}$"}, { "Note": "Introduced in 2006, gradually implemented throughout 2007.", "Country": "Albania", "ISO": "AL", "Format": "NNNN", "Regex": "^\\d{4}$"}, { "Note": "First two as in ISO 3166-2:DZ", "Country": "Algeria", "ISO": "DZ", "Format": "NNNNN", "Regex": "^\\d{5}$"}, { "Note": "U.S. ZIP codes (range 96799)", "Country": "American Samoa", "ISO": "AS", "Format": "NNNNN (optionally NNNNN-NNNN or NNNNN-NNNNNN)", "Regex": "^\\d{5}(-{1}\\d{4,6})$"}, { "Note":
<sap.ui.core:FragmentDefinition
xmlns:sap.ui.core="sap.ui.core"
xmlns:sap.m="sap.m"
xmlns:sap.ui.layout.form="sap.ui.layout.form"
xmlns:sap.ui.core.mvc="sap.ui.core.mvc" >
<sap.m:Panel headerText="dfdff" expandable="true" expanded="true">
<sap.m:customData>
<sap.ui.core:CustomData key="sap-ui-fastnavgroup" value="true" writeToDom="true"></sap.ui.core:CustomData>
</sap.m:customData>
<sap.m:content>
return (function(q, _, context) {
debugger;
var defer = q.defer();
sap.ui.require(["aicomp/domain/element/api", "aicomp/service/noty"], function(
api,
noty
) {
var current = api.current();
var flatcodes = flattenAndGroup(current);
api.model().setProperty("/flat_codes_start", shallowclone(flatcodes));
/***
*
* Extends jQuery with dropbox crud functionality
*
* All API methods return a promise unless specified otherwise.
*
*/
(function($) {
jQuery.extend({
dropboxAuth: new DropboxAuth(),
@matthewbednarski
matthewbednarski / mimeapps.list
Created March 11, 2015 10:44
Instruct xdg to use mutt as default email application. Both files go in ~/.local/share/applications
[Default Applications]
x-scheme-handler/mailto=mutt.desktop;
@matthewbednarski
matthewbednarski / SpringBootServletRegistrationOverrides.java
Created August 26, 2015 07:22
An example for a Spring Boot Application which overrides the default servlet registration
import org.glassfish.jersey.servlet.ServletContainer;
import org.glassfish.jersey.servlet.ServletProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
import org.springframework.web.filter.DelegatingFilterProxy;
import org.springframework.web.servlet.DispatcherServlet;
@matthewbednarski
matthewbednarski / test
Created December 14, 2016 08:27
Hello!
Welcome to StackEdit!
===================
Hey! I'm your first Markdown document in **StackEdit**[^stackedit]. Don't delete me, I'm very helpful! I can be recovered anyway in the **Utils** tab of the <i class="icon-cog"></i> **Settings** dialog.
----------
Documents
@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 / jquery.ajax.blob.js
Created October 23, 2015 03:28
Exents $.ajax to return binary formats without string serialization
(function($) {
/**
* http://artandlogic.com/2013/11/jquery-ajax-blobs-and-array-buffers/
*
* Register ajax transports for blob send/recieve and array buffer send/receive via XMLHttpRequest Level 2
* within the comfortable framework of the jquery ajax request, with full support for promises.
*
* Notice the +* in the dataType string? The + indicates we want this transport to be prepended to the list
* of potential transports (so it gets first dibs if the request passes the conditions within to provide the
* ajax transport, preventing the standard transport from hogging the request), and the * indicates that
@matthewbednarski
matthewbednarski / spinner-directive.js
Last active October 2, 2015 14:29
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
replace: true,
scope: {
show: '@',