Skip to content

Instantly share code, notes, and snippets.

View RadLikeWhoa's full-sized avatar

Sacha Schmid RadLikeWhoa

View GitHub Profile
@RadLikeWhoa
RadLikeWhoa / data.js
Created April 19, 2017 15:59
Information Design
window.data = [
{
"Region": "Africa",
"Area": "Algeria",
"Item": "Insecticides",
"Value": 1230
},
{
"Region": "Africa",
"Area": "Algeria",
@RadLikeWhoa
RadLikeWhoa / index.html
Created April 18, 2017 11:35
Life In Weeks
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Skydancer — A Life in Weeks</title>
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Kaushan+Script" />
</head>
<body>
<h1>
@RadLikeWhoa
RadLikeWhoa / index.html
Created April 11, 2017 14:25
Chart Design: Exact Replica
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Chart Design</title>
</head>
<body>
<div id="container"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/5.0.10/highcharts.js"></script>
<script src="who-life-expectancy-by-country.js"></script>
@RadLikeWhoa
RadLikeWhoa / index.html
Last active April 11, 2017 14:23
Chart Design: Highcharts Native
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Chart Design</title>
</head>
<body>
<div id="container"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/5.0.10/highcharts.js"></script>
<script src="who-life-expectancy-by-country.js"></script>
@RadLikeWhoa
RadLikeWhoa / index.html
Last active April 3, 2017 14:27
Emergencies Makeover
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Makeover</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<script src="//d3js.org/d3.v4.min.js"></script>
<script src="main.js"></script>
@RadLikeWhoa
RadLikeWhoa / persons.notebook
Created March 13, 2017 14:28
persons.csv: Apache Zeppelin Notebook
val inputFile = "/Users/Sacha/Google Drive/FHNW/2017 FS/ivis (6iEng)/02-data-exploration/data/persons-raw.csv"
val data = spark.read.format("csv").option("header", "true").option("inferSchema", "true").csv(inputFile)
data.createOrReplaceTempView("persons")
sqlContext.sql("SELECT `Index`, CONCAT(SUBSTRING(`First Name`, 0, 1), LOWER(SUBSTRING(`First Name`, 2))) AS `First Name`, `Last Name`, regexp_replace(`Date Of Birth`, '^.{2}[.].{2}[.].{2}$', CONCAT(SUBSTRING(`Date Of Birth`, 0, 6), '19', SUBSTRING(`Date Of Birth`, 7, 8))) AS `Date Of Birth`, `Height`, `Weight`, (CASE WHEN `Small Shirt Size` = 'X' THEN 'S' WHEN `Medium Shirt Size` = 'X' THEN 'M' WHEN `Large Shirt Size` = 'X' THEN 'L' ELSE null END) AS Shirtsize, `Hair Color` FROM persons WHERE `Index` IS NOT NULL").show(1000)
@RadLikeWhoa
RadLikeWhoa / persons.wrangle
Created March 13, 2017 09:33
persons.csv: Trifacta Wrangler recipe
splitrows col: column1 on: '\n' quote: '\"'
split col: column1 on: ',' limit: 9 quote: '\"'
replace col: * with: '' on: '\"' global: true
header
delete row: ismissing([Index])
replace col: Small_Shirt_Size with: 'S' on: /X/
replace col: Medium_Shirt_Size with: 'M' on: /X/
replace col: Large_Shirt_Size with: 'L' on: /X/
merge col: Small_Shirt_Size,Medium_Shirt_Size,Large_Shirt_Size as: 'Shirt_Size'
drop col: Small_Shirt_Size,Medium_Shirt_Size,Large_Shirt_Size

This is the localisation file for a new Chrome extension of mine. It is used in the extension itself ("the popup"), as well as throughout the options window.

The messages are grouped based on their function, please keep the grouping as-is. There's no need to translate the descriptions, please only translate the messages.

function getStorageSize () {
var size = 3
for (var prop in localStorage) {
size += ((localStorage[prop].length * 16) / (8 * 1024))
}
return size
}
@RadLikeWhoa
RadLikeWhoa / jsonp.js
Last active December 20, 2015 13:29
(function () {
var _id = 0
window.jsonp = function (url, callback) {
var id = 'jsonp_cb_' + _id,
existing = document.scripts[0],
script = document.createElement('script')
window[id] = function (data) {
script.parentNode.removeChild(script)