Skip to content

Instantly share code, notes, and snippets.

@MoritzStefaner
MoritzStefaner / .block
Last active October 15, 2024 16:35
Force-based label placement
license: apache-2.0
package eu.stefaner.researchdensity {
import eu.stefaner.flareextensions.Helpers;
import flare.animate.Transitioner;
import flare.util.Property;
import flare.vis.Visualization;
import flare.vis.data.Data;
import flare.vis.data.DataList;
import flare.vis.data.NodeSprite;
@MoritzStefaner
MoritzStefaner / gist:3423911
Created August 22, 2012 09:02
Sample class for rendering a gephi layout with Java/processing
import java.io.File;
import java.io.FileNotFoundException;
import java.net.URISyntaxException;
import org.gephi.data.attributes.api.AttributeController;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.filters.api.FilterController;
import org.gephi.graph.api.DirectedGraph;
import org.gephi.graph.api.Edge;
@MoritzStefaner
MoritzStefaner / citysearch.py
Created December 6, 2012 11:05
Search where people are moving in Germany
# coding: utf-8
# requires: pattern http://www.clips.ua.ac.be/pages/pattern
from pattern.web import *
import csv
import sys
# yeah I know
reload(sys)
sys.setdefaultencoding("utf-8")
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours.
{It's|It is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as you did, the {internet|net|web} will be {much more|a lot
more} useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting.
{Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch}
your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or
{newsletter|e-newsletter} service. Do {you have|you've} any?
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe.
@MoritzStefaner
MoritzStefaner / _.md
Created May 17, 2014 13:57
Path information from Illustrator
{a, ul, ol, li, div, img, h2, h3, form, input, button} = React.DOM
Component = (o) -> React.createFactory React.createClass o
app = undefined
$ ->
app = React.render App({}), $("#app")[0]
App = Component(
getInitialState: ->
{
@MoritzStefaner
MoritzStefaner / _guess.py
Last active September 10, 2015 15:22
(Roughly) gender guessing ars submissions. This is based on the first names of ars electronica submissions up to 2008. Gender guess through https://pypi.python.org/pypi/gender-detector/0.0.4. Results: ({'male': 14847, 'unknown': 10772, 'female': 5281}) estimated 26.2% women
# requires https://pypi.python.org/pypi/gender-detector/0.0.4
from gender_detector import GenderDetector
from collections import defaultdict, Counter
f = open("firstnames.txt", "r")
detector = GenderDetector('us')
count = 0
@MoritzStefaner
MoritzStefaner / frustrations.tsv
Created March 17, 2017 20:50
Text answers from the dataviz survey 2017 by Elijah Meeks et al.
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
""
Comp
""
Getting data into the right format/place to do analysis & vis
Poor data governance
Antiquated data architecture
Try to be data driven- but our data efforts aren't consistent
firewalls preventing the movement of data and marketing professionals with no analytical knowledge
""
The lack of time to do original data journalism: lack of proper training and opportunity to expand skills into coding.

{ "python.venvPath": "${workspaceFolder}/.venv/bin/python", "python.pythonPath": ".venv/bin/python", }