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":
@matthewbednarski
matthewbednarski / clear-scm-manager-caches.groovy
Created August 21, 2014 19:57
clear scm-manager's caches
// taken from
// https://groups.google.com/forum/#!topic/scmmanager/tvfhJWDlTO8
// requires the scm-manager plugin scm-script-plugin
import sonia.scm.*;
import sonia.scm.cache.*;
import sonia.scm.repository.*;
import sonia.scm.repository.api.*;
import sonia.scm.activity.ActivityManager;
import sonia.scm.activity.ActivitySet;
@matthewbednarski
matthewbednarski / countdown.sh
Created September 5, 2014 20:16
a countdown timer
#!/bin/bash
IFS=:
set -- $*
param1=0
param2=0
param3=0
if [ ${3} > 0 ]; then
param3=${3}
fi
@matthewbednarski
matthewbednarski / index.html
Created March 2, 2015 14:24
Angular 1.3 Filtering Angular 1.3 controller with directives applying filters to underlying data // source http://jsbin.com/kadeba
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Angular 1.3 controller with directives applying filters to underlying data">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script>
<meta charset="utf-8">
<title>Angular 1.3 Filtering</title>
</head>
@matthewbednarski
matthewbednarski / index.html
Created March 2, 2015 15:10
Moment parametrized date range An example of a parametrized callback for filtering by date range. // source http://jsbin.com/venape
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="An example of a parametrized callback for filtering by date range.">
<script src="https://rawgit.com/lodash/lodash/3.0.1/lodash.min.js"></script>
<script src="http://momentjs.com/downloads/moment.min.js"></script>
<meta charset="utf-8">
<title>Moment parametrized date range</title>
</head>
<body>
@matthewbednarski
matthewbednarski / index.html
Created March 10, 2015 14:17
An AngularJS tree directive example An AngularJS tree directive example // source http://jsbin.com/batilixaqa
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="An AngularJS tree directive example">
<meta name="link-inspiration" content="http://stackoverflow.com/questions/14430655/recursion-in-angular-directives">
<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="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script>
<meta charset="utf-8">
@matthewbednarski
matthewbednarski / app.js
Last active August 29, 2015 14:16
An AngularJS tree directive example// source http://jsbin.com/batilixaqa
var module = angular.module('app', []);
module
.controller('treeItems', ['$scope',
function($scope) {
$scope.family = {
name: 'test',
parent: undefined,
children: []
};
}
@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 / d3-pie-chart.html
Last active August 29, 2015 14:19
D3 pie chart with changing random dataD3 pie chart with changing random data// source http://jsbin.com/yakogo
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="D3 pie chart with changing random data"/>
<meta name="sources" content="http://bl.ocks.org/dbuezas/9306799" />
<meta name="sources" content="http://bl.ocks.org/jonsadka/fa05f8d53d4e8b5f262e" />
<script src="https://rawgit.com/lodash/lodash/3.0.1/lodash.min.js"></script>
<script src="http://d3js.org/d3.v3.min.js"></script>
<meta charset="utf-8">
@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" />