Skip to content

Instantly share code, notes, and snippets.

View kevinmorio's full-sized avatar
💭

Kevin Morio kevinmorio

💭
View GitHub Profile
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@kevinmorio
kevinmorio / Graph.java
Created August 16, 2015 17:39
Generic Graph implementation
import java.util.*;
// based on the work of Robert Sedgewick and Kevin Wayne
public class Graph<T> implements Iterable<T> {
private Map<T, Set<T>> verticesMap;
private int edgesCount;
public Graph() {
verticesMap = new HashMap<>();
import java.util.Objects;
public class Zone {
private String name;
public Zone(String name) {
this.name = name;
}
@Override
public class Game {
public static void main(String[] args) {
Graph<Zone> gameMap = new Graph<>();
Zone zone1 = new Zone("Zone1");
Zone zone2 = new Zone("Zone2");
Zone zone3 = new Zone("Zone3");
Zone zone4 = new Zone("Zone4");
Zone zone5 = new Zone("Zone5");
Zone zone6 = new Zone("Zone6");
@kevinmorio
kevinmorio / Graph.js
Created September 11, 2015 19:55
Graph implementation
var Graph = function() {
this.verticesMap = new Map();
this.edgesCount = 0;
};
Graph.prototype.getNumVertices = function() {
return this.verticesMap.size;
}
Graph.prototype.getNumEdges = function() {
var Zone = function(name) {
this.name = name;
}
Zone.prototype.toString = function() {
return "Zone " + this.name;
}
var gameMap = new Graph();
zone1 = new Zone("Zone1");
zone2 = new Zone("Zone2");
zone3 = new Zone("Zone3");
zone4 = new Zone("Zone4");
zone5 = new Zone("Zone5");
zone6 = new Zone("Zone6");
zone7 = new Zone("Zone7");
zone8 = new Zone("Zone8");
@kevinmorio
kevinmorio / zotfile-user-wildcards.json
Created December 15, 2020 14:52
ZotFile user wildcards for title and original date
{
"T": {
"field": "title",
"operations": [
{
"function": "replace",
"regex": "\\s*[.:;?!|].*",
"replacement": ""
},
{