Skip to content

Instantly share code, notes, and snippets.

View emmasaunders's full-sized avatar

Emma Saunders emmasaunders

  • London, UK
View GitHub Profile
@emmasaunders
emmasaunders / readme.md
Last active October 10, 2023 16:40
How to import the sakila database into MySQL

##The old method, via phpmyadmin The first time I downloaded the sakila database, I did it via phpmyadmin using Import at the Server level. I did not use a command line. I did not create a database called Sakila and then populate it: the .sql files delete and re-create the database anyway. I imported the schema file and then the data file, ignoring the .mwb file, which is only useful if you have MySQL Workbench installed, at which point it supplies you a database diagram. A nice-to-have, but not critical in creating a database.

When I imported the files, I had to untick the box that said "Allow the interruption of an import in case the script detects...". I also had to temporarily change MySQL's maximum import size (using a line of SQL I found online): https://dev.mysql.com/doc/refman/5.5/en/packet-too-large.html

Today I find this method does not work. I get an error about geometry (which is due to a commented out line in the SQL). Even when I remove the commented out lines (whose purpose is to create spa

@emmasaunders
emmasaunders / index.html
Last active October 9, 2017 04:09
Interpolation (v4)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Interpolation methods, by Emma Saunders at Viz Data Ltd. (UK)</title>
<script type="text/javascript" src="http://d3js.org/d3.v4.js"></script>
@emmasaunders
emmasaunders / d3Functions.json
Last active October 20, 2016 10:23
Tree (v4)
{
"name": "d3",
"children": [
{
"name": "svg",
"children": [
{"name":"axis"},
{ "name":"line", "children": [{"name":"radial"}]},
{ "name":"area", "children": [{"name":"radial"}] },
@emmasaunders
emmasaunders / index.html
Last active February 9, 2024 16:13
Colours (v4)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>D3 and colorbrewer color ranges in d3.js</title>
<script type="text/javascript" src="http://d3js.org/d3.v4.min.js"></script>
<script src="http://colorbrewer2.org/export/colorbrewer.js"></script>
<style>
html, body {
@emmasaunders
emmasaunders / axis.js
Last active October 20, 2016 10:29
Axes (v4)
var chartWidth = 600;
var chartHeight = 50;
var stringDates = ['1/1/2003', '2/1/2003', '3/1/2003', '4/1/2003', '5/1/2003', '6/1/2003'];
var parseDate = d3.timeParse("%m/%d/%Y");
var a = d3.scalePoint().domain(['Apples','Oranges','Pears','Plums']).range([0,chartWidth]);
var b = d3.scalePoint().domain([1, 2, 3, 4]).range([0, chartWidth]);
var c = d3.scalePoint().domain([1, 2, 3, 4]).rangeRound([0, chartWidth]);
@emmasaunders
emmasaunders / index.html
Last active October 22, 2021 10:53
Text alignment (v4)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>SVG text alignment using d3 by Emma Saunders of Viz Data Ltd. (UK)</title>
<script type="text/javascript" src="http://d3js.org/d3.v4.min.js"></script>
<style>
html, body {
margin: 0;
@emmasaunders
emmasaunders / index.html
Last active October 20, 2016 10:38
Line chart from csv (v4)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Line chart from CSV using d3.js</title>
<script type="text/javascript" src="https://d3js.org/d3.v4.min.js"></script>
<style>
html, body {
margin: 0;
@emmasaunders
emmasaunders / index.html
Last active October 19, 2016 14:24
Line chart from csv (v3)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Line chart from CSV using d3.js</title>
<script type="text/javascript" src="https://d3js.org/d3.v3.min.js"></script>
<style>
html, body {
margin: 0;
@emmasaunders
emmasaunders / index.html
Last active October 19, 2016 14:34
d3 color scales & colorbrewer (v3)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>D3 and colorbrewer color ranges in d3.js</title>
<script type="text/javascript" src="https://d3js.org/d3.v3.min.js"></script>
<script src="http://colorbrewer2.org/export/colorbrewer.js"></script>
<style>
html, body {
@emmasaunders
emmasaunders / d3Functions.json
Last active August 6, 2016 17:51
d3 commands (v3)
{
"name": "d3",
"children": [
{
"name": "svg",
"children": [
{"name":"axis"},
{ "name":"line", "children": [{"name":"radial"}]},
{ "name":"area", "children": [{"name":"radial"}] },