Skip to content

Instantly share code, notes, and snippets.

@michalskop
michalskop / bubbles_kraje.html
Last active November 2, 2016 03:28
CZ 2016: regional and senate elections
<!DOCTYPE html>
<meta charset="utf-8">
<title>Krajské volby 2016 a 2012</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<style>
.node rect {
cursor: move;
fill-opacity: .9;
@michalskop
michalskop / chart.html
Last active August 3, 2016 23:50
CZ 2013: Greens+Pirates+Change
<!DOCTYPE html>
<html lang="sk">
<head>
<meta charset="utf-8">
<title>Zelení + Piráti + Změna 2013</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="WPCA scatter plot">
<meta name="author" content="Michal Škop">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootswatch/3.2.0/journal/bootstrap.min.css">
@michalskop
michalskop / api.example.com.conf
Last active February 13, 2024 09:35
Setting up an Ubuntu server
<VirtualHost *:80>
# example of settings for Postgrest API
ServerAdmin [email protected]
ServerName api.example.com
ProxyPreserveHost On
# setup the proxy
<Proxy *>
Order allow,deny
Allow from all
@michalskop
michalskop / README.md
Last active June 5, 2017 22:09
SK 2016: General Elections
@michalskop
michalskop / analysis.md
Last active April 21, 2016 18:57
Analytics in Volebná kalkulačka 2016

Analytics in Volebna kalkulacka 2016

https://volebnakalkulacka.sk

AB testing

Clicking on detailed comparison

Example Page: https://volebnakalkulacka.sk/match/?q1=1

Explanation: A user may click on name of a party and get the detailed comparison between their answers and the party's answers. Our aim is to engage poeple to see the detailed comparisons.

@michalskop
michalskop / get_mps.py
Created December 18, 2015 13:50
Get Czech MEPs from hlidame.je
# get all Czech MEPs
# importing necessary packages
import requests
import json
import csv
# get the data
url = "http://api.hlidame.je/rest/hlidame/people?app_name=hlidame"
r = requests.get(url)
@michalskop
michalskop / calc_matches_our.py
Last active December 3, 2015 04:55
CZ: Selection of questions in VAA 2013
'''calculate distances'''
import csv
from random import shuffle
import copy
#parties
def option2numeric_party(v):
if v == 'yes':
return 1
@michalskop
michalskop / README.md
Last active December 4, 2015 01:40
Distances in VAAs

Charts of Distributions of Candidates or Parties in VAAs

The charts prepared for the article "Measures of Differentiation among Candidates as an Indicator of the Quality of Voting Advice Applications": https://docs.google.com/document/d/1KVTso9cdwvCxhPC3bEp8rAEY_7v3gWvCzHNYVOjcMR8/edit

Includes Wahl-O-Mat (Germany) 2005, 2009, 2013; StemWijzer (Netherlands) 2006, 2010, 2012; and Volební kalkulačka (Czech Republic) 2013

@michalskop
michalskop / chart_row_reusable.html
Last active September 8, 2015 22:32
Timeline plot, barplot (reusable, responsive)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Chart</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Plot">
<meta name="author" content="Michal Škop">
<script src="//cdn.bootcss.com/d3/3.5.6/d3.min.js"></script>
@michalskop
michalskop / c2.html
Last active October 25, 2015 11:31
EU: Spatial model 2014-2015
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>W-PCA Scatterplot Chart</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="WPCA scatter plot">
<meta name="author" content="Michal Škop">
<script src="http://d3js.org/d3.v3.min.js"></script>