This is a simple map of Sweden, created with D3.js and TopoJSON. The municipality polygons have been replaced by circles.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var PejlCharts = PejlCharts || {}; | |
// Extend D3 | |
d3.scale.pejl5 = d3.scale.ordinal().range(['#008EBD','#EA6899','#F02A09','#0ACA91','#EDE481']); | |
d3.scale.pejlSignals = d3.scale.ordinal().range(['#079100','#C3CE0F','#F49D06','#FF5A00','#B60C0C']); | |
// The charts | |
PejlCharts.BarChart = function() { | |
var margin = {top: 20, right: 20, bottom: 30, left: 40}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Router = { | |
routes: [], | |
route: '', | |
getFragment: function() { | |
return location.hash.replace('#',''); | |
}, | |
add: function(path, handler) { | |
this.routes.push({ path: path, handler: handler }); | |
}, | |
remove: function(path) { |
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 10.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"question","answer" | |
"I Charles Dickens ”A Christmas Carol” blir Scrooge besökt av spöket av sin avlidne kollega. Vad heter han? Marlow, Marley eller Morgan?","Marley" | |
"Vilken är världens mest lästa bok (under de senaste 50 åren)?","Bibeln" | |
"Från vilket land kom årets nobelpristagare i litteratur? ","Frankrike" | |
"Vilket årtionde ”upptäcktes” syret? ","1770" | |
"Vilket århundrade myntades termen dinosaur, samma århundrade som man även började utforska dinosaurierna?","1800" | |
"Vilken teori gav Einstein nobelpriset i fysik? ","Fotoelektrisk effekt" | |
"Ishockeyspelaren Peter ""Foppa"" Forsberg blev i år invald i NHL:s Hall of Fame som tredje svensk. Vilka är dom övriga två spelarna?","Börje Salming och Mats Sundin" | |
"Malmö FF vann för andra året i rad fotbollsallsvenskan. Det är första gången sedan 2003 ett lag försvarade sin titel, vilket lag var det som senast innan Malmö FF försvarade en titeln?","Djurgården" | |
"När Dan Eliasson nyligen utsågs till Rikspolischef uppmärksammades hans förflutna i ett punkband som 1979 spe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from pycar_advanced import utils | |
class UtilsTestCase(unittest.TestCase): | |
def test_slugify(self): | |
"""Test utils.slugify""" | |
# It should: | |
# | |
# * Remove punctuation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_results(results_list): | |
""" | |
Generate an iterator of Result objects from a list of dictionary | |
containing result attributes | |
Args: | |
results_list: An iterable of dictionaries representing election | |
results. Each dictionary should have at least the following | |
keys: `candidate_name`, `candidate_id`, and `total_votes`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(window).ready(function() { | |
var weekdays = ['Söndag', 'Måndag', 'Tisdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lördag'], | |
months = ['Januari', 'Februari', 'Mars', 'April', 'Maj', 'Juni', 'Juli', 'Augusti', 'September', 'Oktober', 'November', 'December']; | |
var d = new Date(); | |
$('#pejl-weekday').html(weekdays[d.getDay()]); | |
$('#pejl-date').html(d.getDate()); | |
$('#pejl-month').html(months[d.getMonth()]); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var svg; | |
d3.json('bounds.json', function(bounds) { | |
window.bounds = bounds; | |
initMap(); | |
}); | |
function initMap() { | |
var map = d3.select('#map'), | |
width = $('#map').width(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var svg; | |
d3.json('bounds.json', function(bounds) { | |
window.bounds = bounds; | |
initMap(); | |
}); | |
function initMap() { | |
var map = d3.select('#map'), | |
width = $('#map').width(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Om modulen körs direkt, d.v.s. inte importeras | |
# Ignorera om du inte börjat importera moduler | |
if __name__ == '__main__': | |
# Tecknet för radbrytning | |
sep = '\n' | |
# Spara varje rad som användaren matar in | |
# Avbryt när en blank rad matas in |
OlderNewer