Skip to content

Instantly share code, notes, and snippets.

Jiří Chadima JirkaChadima

Block or report user

Report or block JirkaChadima

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@JirkaChadima
JirkaChadima / hotel-org.json
Last active Jul 2, 2019
Onboarding demo hacktravel Lisbon 2019
View hotel-org.json
{
"updatedAt": "2019-07-01T08:12:35.584Z",
"dataFormatVersion": "0.2.3",
"legalEntity": {
"name": "Onboarding demo hotel",
"contacts": {
"general": {
"email": "windingtree-hotel-mazurka@mailinator.com",
"phone": "+40213191564",
"url": "https://www.hotel-mazurka.com"
View legal-entity-hotel-api.json
@JirkaChadima
JirkaChadima / ISO-639-1-language.json
Last active Feb 21, 2019 — forked from jrnk/ISO-639-1-language.json
ISO 639-1 Alpha-2 codes of languages JSON
View ISO-639-1-language.json
[
{
"code": "ab",
"name": "Abkhaz"
},
{
"code": "aa",
"name": "Afar"
},
{
@JirkaChadima
JirkaChadima / index.html
Last active Jul 1, 2019
Simple sample booking page for Winding Tree
View index.html
<html lang="en">
<head>
<meta charset="utf-8">
<title>Winding Tree simple sample booking page</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
</head>
<body class="container">
<div id="error" class="alert"></div>
<div id="hotel-description">
<h1 id="hotel-name"></h1>
View index.js
const WTLibs = require('@windingtree/wt-js-libs');
const SwarmAdapter = require('@windingtree/off-chain-adapter-swarm');
const HttpAdapter = require('@windingtree/off-chain-adapter-http');
const libs = WTLibs.createInstance({
dataModelOptions: {
provider: 'https://ropsten.infura.io/',
},
offChainDataOptions: {
adapters: {
View map.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View mapping.java
//...
// java code
//...
/**
* https://stackoverflow.com/a/38675842
*/
protected boolean isInside(Point p, Polygon polygon) {
if (polygon == null) {
return false;
}
@JirkaChadima
JirkaChadima / refresh-data.sh
Last active Jan 30, 2018
cz-region-boundaries snippets
View refresh-data.sh
#!/bin/bash
# GPS data passed through https://github.com/tyrasd/osmtogeojson
curl -X POST 'https://lz4.overpass-api.de/api/interpreter' -d@overpass-query.txt | osmtogeojson > src.geojson
# utility script from https://github.com/JirkaChadima/cz-region-boundaries/blob/master/scripts/prepare-gps-data.js
node prepare-gps-data.js
# ZIP codes processing
PSCSOURCE='https://www.ceskaposta.cz/documents/10180/3738087/xls_pcobc.zip/50617e56-6e9a-4335-9608-96fec214e6ef'
# https://github.com/JirkaChadima/cz-region-boundaries/blob/master/data/zip/county-region.csv, collected from https://cs.wikipedia.org/wiki/Okresy_v_%C4%8Cesku#Okresy_podle_samospr%C3%A1vn%C3%BDch_kraj%C5%AF
OKRESFILE="../data/zip/county-region.csv"
@JirkaChadima
JirkaChadima / backend.py
Last active Jun 30, 2017
listen-notify-backend
View backend.py
from eventlet.hubs import trampoline
def start_listening(queue):
"""Connects to PgSQL and listens to notifications, inspired by http://initd.org/psycopg/articles/2010/12/01/postgresql-notifications-psycopg2-eventlet/"""
if not queue:
return
connection = psycopg2.connect(DSN)
cursor = connection.cursor()
cursor.execute("LISTEN field_value_change")
@JirkaChadima
JirkaChadima / pgsql.py
Created Jun 27, 2017
listen-notify-database-handler
View pgsql.py
# http://initd.org/psycopg/docs/advanced.html#asynchronous-notifications
import select
import psycopg2
import psycopg2.extensions
conn = psycopg2.connect(DSN)
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
curs = conn.cursor()
cursor.execute("LISTEN field_value_change")
You can’t perform that action at this time.