Skip to content

Instantly share code, notes, and snippets.

View botic's full-sized avatar
👔
working for @orfon and @diehauswirtschaft

Philipp Naderer-Puiu botic

👔
working for @orfon and @diehauswirtschaft
View GitHub Profile
Corrected Biberstrasse 15 into Biberstraße 15
Corrected Franz Josefs Kai 29 into Franz-Josefs-Kai 29
Stripping tail Mahler from Kaerntnerring 9-13/Mahler
Stripping tail Herrnhuterhaus from Neuer Markt 17 / Herrnhuterhaus
Corrected Neuer Markt 17 into Neuer Markt 17
Corrected Singerstrasse 6 into Singerstraße 6
Corrected Engerthstrasse 160-178 into Engerthstraße 160-178
Corrected Franzensbrueckenstrasse 20 into Franzensbrückenstraße 20
Corrected Heinestrasse 2 into Heinestraße 2
Stripping tail Schiffamtsgasse 15 from Malzgasse 8/Schiffamtsgasse 15
@botic
botic / sitemap-generator.js
Created September 27, 2018 17:11
Generator for a sitemap.xml in Node.js
"use strict";
const DOMAIN = "example.com";
const URLS_PER_FILE = 40000;
const fs = require("fs");
const readline = require("readline");
const rd = readline.createInterface({
input: fs.createReadStream(`${__dirname}/input/ids-and-dates.txt`)
});
module.exports = [
// needs replacement of uppercase characters
["Stadtpark/C WC-ANLAGE" , "Stadtpark WC-Anlage" ],
["Franz-Josefs-Kai 6 GASTRO-KIOSK 1" , "Franz-Josefs-Kai 6 Gastro-Kiosk 1" ],
["Seilerstätte 3D/910(GARAGE)" , "Seilerstätte 3D/910 (Garage)" ],
["Parkring 12A (HOTEL)" , "Parkring 12A (Hotel)" ],
["Franz-Josefs-Kai TIEFGARAGE" , "Franz-Josefs-Kai Tiefgarage" ],
["Herbert-von-Karajan-Platz KIOSK" , "Herbert-von-Karajan-Platz Kiosk" ],
["Schmerlingplatz (TIEFGARAGE)" , "Schmerlingplatz (Tiefgarage)" ],
["Seilerstätte 3E (KUNDENEINGANG)" , "Seilerstätte 3E (Kundeneingang)" ],
Achim
Adolf
Albert
Alexander
Alexandra
Alfred
Ali
Alois
Andrea
Andreas
@botic
botic / times.js
Created December 19, 2017 20:20
Optimized business hours rendering of raw 📖StadtKatalog entries
const Calendar = java.util.Calendar;
const weekdayKeys = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
const equalTimeFrames = function(a, b) {
if (a.length !== b.length) {
return false;
}
for (let i = 0; i < a.length; i++) {
if (a[i] !== b[i]) {
@botic
botic / hap-84a.json
Last active December 4, 2017 22:18
GTFS Denormalization
{
"fields": [
"trip_id",
"arrival_time",
"departure_time",
"stop_id",
"stop_sequence",
"route_id",
"service_id",
"agency_id",
@botic
botic / geocoder.js
Created July 16, 2017 10:22
Geocoder
const addresses = require("./wien22.json");
const lookup = function(name, number) {
return addresses.features.find(function(feature) {
return feature.properties["NAME_STR"].indexOf(name) === 0 && feature.properties["NAME_ONR"].indexOf(number) === 0;
});
};
const splitAddress = function(fullName) {
const numberReg = /\ [1-9][0-9]?([-–][1-9][0-9]?)?/g;
@botic
botic / main.js
Created June 19, 2017 08:18
Example to start HTTPS
/**
* @fileoverview The main application module. Start the application with the
* following command line:
*
* ringo path/to/main.js
*
* This will start the application using default configuration values. To customize
* create a directory containing the files `config.json`, `log4j.properties`.
* Then start the application using the following command line:
* ringo path/to/main.js -h path/to/config/directory
@botic
botic / false.json
Created May 30, 2017 17:58
sharable.js
{
"recipient":{
"id":"12345"
},
"message":{
"attachment":{
"type":"template",
"payload":{
"template_type":"button",
"text":"Need a link not to share?",
@botic
botic / ringojs.service
Created April 19, 2017 15:29
RingoJS Unit
[Unit]
Description=RingoJS App
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=simple
WorkingDirectory=/usr/local/ringojs-apps/my-app-dir/
ExecStart=/usr/bin/ringo --production -Dringo.home=/usr/share/ringojs -J-server -Djava.awt.headless=true \
-J-Xms256M -J-Xmx256M -J-Xbootclasspath/p:/usr/share/ringojs/lib/js.jar \
-m /usr/local/ringojs-apps/my-app-dir/packages/ \