Skip to content

Instantly share code, notes, and snippets.

View joshy's full-sized avatar

Joshy Cyriac joshy

  • Universitätsspital Basel
  • Basel
View GitHub Profile
@joshy
joshy / urban-population-of-switzerland.csv
Created August 18, 2015 12:39
Urban population of Switzerland from 1991 - 2013 in 1'000. Source http://www.bfs.admin.ch/xmlns/opendata/je-e-01.02.01.01.03.ods
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 25 columns, instead of 15 in line 4.
Agglomeration,Number of communes,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013
Aarau ,17 ,76.5 ,76.7 ,77.6 ,77.7 ,78.1 ,78.2 ,78.2 ,78.3 ,78.7 ,79.1 ,79.7 ,80.3 ,81.0 ,81.8 ,82.3 ,83.1 ,83.8 ,85.1 ,86.4 ,88.0 ,89.3 ,90.7 ,91.7
Amriswil-Romanshorn ,5 ,22.6 ,22.9 ,23.3 ,23.6 ,24.0 ,24.0 ,24.2 ,24.0 ,24.0 ,24.1 ,24.0 ,24.2 ,24.4 ,24.6 ,24.7 ,24.8 ,25.0 ,25.4 ,25.8 ,26.3 ,26.8 ,27.3 ,27.7
Arbon-Rorschach ,11 ,54.6 ,54.9 ,55.3 ,55.6 ,55.7 ,55.7 ,55.6 ,56.0 ,56.0 ,56.1 ,56.2 ,56.4 ,56.6 ,56.7 ,56.7 ,57.0 ,57.8 ,58.5 ,59.0 ,59.4 ,59.7 ,60.1 ,60.6
Baden-Brugg ,22 ,100.9 ,101.6 ,102.5 ,102.8 ,103.5 ,103.7 ,103.8 ,104.2 ,104.8 ,105.7 ,107.3 ,108.2 ,
@joshy
joshy / HackerNewsExample.elm
Last active August 29, 2015 14:25 — forked from TheSeamau5/HackerNewsExample.elm
Hacker news requests example
--------------------------
-- CORE LIBRARY IMPORTS --
--------------------------
import Task exposing (Task, ThreadID, andThen, sequence, succeed, spawn)
import Json.Decode exposing (Decoder, list, int, string, (:=), map, object2)
import Signal exposing (Signal, Mailbox, mailbox, send)
import List
---------------------------------
-- THIRD PARTY LIBRARY IMPORTS --
import Signal
import Graphics.Element exposing (Element, show)
import Task exposing (Task)
main : Signal Element
main =
Signal.map show contentMailbox.signal
import Graphics.Element (..)
import Signal (Signal, map, map2, sampleOn)
import Mouse
import Text (asText)
import Window
main : Signal Element
main = map asText mousePos
@joshy
joshy / move-point.elm
Created August 19, 2014 11:25
Simple example of drawing a point and then make that point "moveable"
import Mouse
import Window
main : Signal Element
main = lift2 scene Window.dimensions lastClickLocation
input : Signal (Int, Int)
input = sampleOn Mouse.clicks Mouse.position
@joshy
joshy / bezier.elm
Last active March 22, 2016 19:48
Bezier curve in Elm
import Mouse
import Window
import Signal as S
import Color exposing (..)
import List exposing (..)
import Graphics.Collage exposing (..)
main = S.map2 draws Window.dimensions stateSignal
@joshy
joshy / functor-example.hs
Created August 4, 2014 11:50
Functor example from FP Complete
import Safe (readMay)
display maybeAge =
case maybeAge of
Nothing -> putStrLn "Could not read input."
Just age -> putStrLn $ "In 2020, you will be: " ++ show age
yearToAge age = 2020 - age
main = do
@joshy
joshy / alice-word-count
Created July 9, 2014 13:01
Apache Pig - Word count explained
-- Read the whole book and save it to input_lines
input_lines = LOAD 'alice-im-wunderland.txt' using TextLoader() as (line:chararray);
-- Extract words from each line and put them into a pig bag
-- datatype, then flatten the bag to get one word on each row
words = foreach input_lines generate flatten(TOKENIZE(line)) AS word;
-- filter out any words that are just white spaces
filtered_words = FILTER words by word MATCHES '\\w+';
@joshy
joshy / rotateSquare.elm
Last active August 29, 2015 14:00
Rotate a square a couple of times with elm
square : Path
square = path [ (50,50), (50,-50), (-50,-50), (-50,50), (50,50) ]
blueSquare : Form
blueSquare = traced (dashed blue) square
rotateSquareBy : Float -> Form
rotateSquareBy deg = rotate deg blueSquare
degrees : [number]
@joshy
joshy / santa.dart
Last active December 30, 2015 21:39
santa.dart A try to learn dart, solution to the "santa problem" https://plus.google.com/118397406534237711570/posts/XjgFRvqtVA4
import 'dart:io';
import 'dart:async';
import 'dart:convert';
import 'dart:collection';
void main() {
print("Please, enter 'first name' and 'last name' finish with a empty line\n");
Stream cmdLine = stdin
.transform(UTF8.decoder)
.transform(new LineSplitter());