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 November 13, 2022 07:15
Publishing your site on GitHub Pages

Hosting your site on GitHub Pages

We're going to start by creating a new repository using GitHub Pages.

Create a new repository

And we're going to name is after ourselves! My github username is jsoma, so I'm going to call my repository jsoma.gitub.io.

Name your repository YOURUSERNAME.github.io. Double-check what your GitHub username is. If you do this part wrong, you'll be sad!

@jsoma
jsoma / README.md
Last active June 5, 2019 22:13
A few styling tips for the MapBox GL map

Setting the style for the MapBox GL map template

Using a color scale

If you have a property called rating that goes from 0-10, this code will fill in your shape based on it. 1 will be a very light blue, 5 will be a slightly darker blue, and 10 will be even more dark. Numbers in between will be estimated (interpolated). Note that including the 5 level was not necessary - if rating were 5, MapBox GL would have guessed a color in between the 1 color and the 10 color.

'fill-color': [
      'interpolate', ['linear'],
 ["to-number", ["get", "rating"]], 
@jsoma
jsoma / stylebot.json
Created March 19, 2019 12:27
Stylebot custom CSS to make multiple-inboxes Gmail look more like Inbox (RIP)
{"mail.google.com":{"_enabled":true,"_rules":{".Cp":{"margin":"0 50px"},".aeJ, .no, .gb_7d.gb_Ce.gb_fe":{"background":"#f2f2f2"},".aia":{"margin":"0 auto","max-width":"840px"},".nK .byN":{"box-shadow":"none"},".oZ-jc.T-Jo.J-J5-Ji":{"margin-left":"0","padding-left":"0"},".oZ-x3::before":{"display":"none"},".zA":{"background":"#fff"},".zt":{"box-shadow":"0 -1px 0 #e0e0e0, 0 0 2px rgba(0,0,0,.12), 0 2px 4px rgba(0,0,0,.24)"},"body":{"font-family":"'Helvetica Neue',Helvetica,Arial,sans-serif"},"comment0":{"comment":"/* Background and general styles */"},"comment1":{"comment":"/* Spacing and groups */"},"comment2":{"comment":"/* Checkbox */"},"comment3":{"comment":"/* View All */"},"comment4":{"comment":"/* Date */"},"comment5":{"comment":"/* click-all/settings bar etc thingies */"},"div > div:nth-child(6) > div:nth-child(1) > .BltHke.nK .byN":{"display":"none"},"div.D.E.G-atb:not(.bP)":{"comment6":{"comment":"/*display: none; */"}},"div.nJ.A2":{"border-color":"#616161","font-size":"100%","font-weight":"normal","m
@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 / README.md
Last active December 17, 2022 02:54
Installing tweego and story-formats on OS X.

Installing tweego is a little more complicated than (I think) it should be, so here's a script to do it for you. If you'd like to one-line it, you can just cut and paste this in Terminal:

/bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/jsoma/5ef3045b2004a610455f371479a6f0cf/raw/b6c9224faa18fd52f3e1bf7120af17eed6da8ec1/tweego.sh)"

Once it's installed, tweego docs are here. You'll probably want to read these twee docs, too.

@jsoma
jsoma / index.html
Last active November 16, 2018 23:36
voronoi map
<!DOCTYPE html>
<style>
.states :hover {
fill: red;
}
.state-borders {
fill: none;
stroke: #fff;
@jsoma
jsoma / matplotlibrc
Created July 12, 2018 14:45
Shortened list of matplotlibrc settings, maybe only the stuff that's important, maybe?
### MATPLOTLIBRC FORMAT
#
# See http://matplotlib.org/users/customizing.html#the-matplotlibrc-file for
# more details on the paths which are checked for the configuration file.
#
### LINES
# See http://matplotlib.org/api/artist_api.html#module-matplotlib.lines for more
# information on line properties.
@jsoma
jsoma / matplotlibrc
Created July 12, 2018 14:13
sample default matplotlibrc file from matplotlib
### MATPLOTLIBRC FORMAT
# This is a sample matplotlib configuration file - you can find a copy
# of it on your system in
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it
# there, please note that it will be overwritten in your next install.
# If you want to keep a permanent local copy that will not be
# overwritten, place it in the following location:
# unix/linux:
# $HOME/.config/matplotlib/matplotlibrc or
@jsoma
jsoma / matplotlib-fonts.py
Created July 10, 2018 03:37
See all of the fonts that matplotlib can access
import matplotlib.font_manager
from IPython.core.display import HTML
def make_html(fontname):
return "<p>{font}: <span style='font-family:{font}; font-size: 24px;'>{font}</p>".format(font=fontname)
code = "\n".join([make_html(font) for font in sorted(set([f.name for f in matplotlib.font_manager.fontManager.ttflist]))])
HTML("<div style='column-count: 2;'>{}</div>".format(code))
@jsoma
jsoma / bootstrap-template.html
Last active July 2, 2023 19:07
A Bootstrap 4 template for a portfolio site (and other things, too). A handful of handy pieces in there, not as complicated or customized as the stuff on https://getbootstrap.com/.
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">