Skip to content

Instantly share code, notes, and snippets.

View jsoma's full-sized avatar

Jonathan Soma jsoma

View GitHub Profile
@jsoma
jsoma / README.md
Last active September 12, 2019 12:14
Putting multiple ai2html exports onto the same HTML page

Putting multiple ai2html exports onto the same HTML page

In the template we've been using, I used @media CSS queries to tell the page which to use at which size. This won't work for larger numbers of graphics (at least without effort), so we're going back to using the JavaScript I used in the YouTube walkthrough.

Step 1: Make your 3 files

Each graphic should be in a different file. Keep them in the same folder, though.

ai files in the same folder

@jsoma
jsoma / README.md
Created September 23, 2019 20:05
How to set up a project for eslint and prettier to catch bugs and be beautiful

Using eslint and prettier to make your code perfect and beautiful and help you catch bugs while you're writing it

Setting up a node project

This doesn't work that well if we don't set up a node project first.

First, open up the homework folder in your text editor, not just the files individually. This is just because it makes life a lot easier, not necessarily because you need to (although... maybe you do?)

On the command line, cd into the folder that your work is in. Or try using View > Terminal from the upper menu to make a terminal open up in VSCode.

@jsoma
jsoma / README.md
Last active October 10, 2019 14:33
Using d3-tip and d3-annotation when you aren't just using a script tag

Since we live in a future that involves cool modern JavaScript and build systems like webpack and Parcel, you might sometimes have a little trouble installing or using JavaScript or D3 libraries. Let's take a look at two, and how we adapt them for our code (specifically with sawhorse).

d3-tip

d3-tip has been around since the earth was formed.

Installing d3-tip

To use d3-tip, we first install it. It's easy.

@jsoma
jsoma / README.md
Last active October 10, 2019 23:57
Working with ai2html and sawhorse

Using ai2html and sawhorse: A walkthrough

So, you need to add an ai2html graphic to your sawhorse-driven page. Let's do it!

First, start with your .ai Illustrator file. You can start with something you exported already, but you can run into a lot of problems, so let's just start from the .ai.

Exporting from Illustrator

Open your Illustrator file up in Illustrator.

@jsoma
jsoma / CORS.json
Created November 20, 2020 19:07
CORS configuration for AWS S3 public files
[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET"
],
"AllowedOrigins": [
"*"
@jsoma
jsoma / chart.py
Last active July 27, 2021 10:04
A perfect easy beautiful simple way to label a stacked bar chart in Python using pandas/matplotlib. Put this in your Jupyter notebook!
#
# WAIT!!!
# WAIT!!!
# You probably don't need this any more! Newer versions of matplotlib
# can do this with built-in magic. See these StackOverflow answers:
#
# https://stackoverflow.com/questions/41296313/stacked-bar-chart-with-centered-labels/60895640#60895640
# https://stackoverflow.com/questions/28931224/adding-value-labels-on-a-matplotlib-bar-chart/67561982#67561982
#
# Big thanks to @trenton3983 for keeping us all up to date!
@jsoma
jsoma / idols.ipynb
Created December 3, 2021 15:26
Notebook and data for kpop idols analysis video https://youtu.be/XHnBUaHvbeo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jsoma
jsoma / lumber-prices.csv
Created December 3, 2021 15:33
Time-series lumber prices analysis for video walkthrough at https://youtu.be/4j9LcUPlKwA
open high low close date
$407.00 $424.70 $377.00 $424.70 1996-12-09T00:00:00
$426.00 $450.50 $395.00 $411.40 1997-01-02T00:00:00
$408.50 $421.50 $382.10 $383.50 1997-02-03T00:00:00
$386.00 $389.70 $355.00 $380.50 1997-03-03T00:00:00
$378.00 $417.50 $376.50 $403.10 1997-04-01T00:00:00
$401.90 $404.40 $370.10 $380.50 1997-05-01T00:00:00
$387.50 $393.10 $347.10 $378.00 1997-06-02T00:00:00
$380.60 $380.90 $332.00 $343.70 1997-07-01T00:00:00
$342.00 $365.90 $341.10 $356.70 1997-08-01T00:00:00
@jsoma
jsoma / stockx.ipynb
Created December 3, 2021 15:35
Basic StockX pandas analysis data and notebook. You can find the notebook here and the data here: https://s3.amazonaws.com/stockx-sneaker-analysis/wp-content/uploads/2019/02/StockX-Data-Contest-2019-3.xlsx
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jsoma
jsoma / ai2html-html.html
Created March 29, 2022 16:15
ai2html-html text block for illustrator
ai2html-html
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/7.3.0/d3.min.js"></script>
<style>
.hidden { visibility: hidden; }
</style>