Skip to content

Instantly share code, notes, and snippets.

# First level filters - Songs currently in play (filters downstream can use any from this set)
- Approved (Not christmas, explicitly disliked, or < 30s, skips are < 3)
- Second chances (Approved, but skips are between 3-4. Not skipped within a year, not played within 240 days. Capped at 200.)
- Third chances (Approved, but skips are between 4-5. Not skipped within 480 days, not played within 360 days. Capped at 100.)
- Last chance (Approved, but skips > 5, Not skipped within 480 days, not played within 360 days. Capped at 50.)
# Second level filters
- 1949 and earlier (songs in play, year is < 1949, not played in 180 days, not skipped in 270 days)
- 1950-1959 (songs in play, year is 1950-1959, not played in 180 days, not skipped in 270 days)
@tBaxter
tBaxter / typography.less
Created July 28, 2017 16:28
Typography from Terra project
// This is a bit over-complicated, in my opinion, but there are some neat ideas.
// Comes from the Terra project (now open sourced) my team at Cerner created.
// Typography
// --------------------------------------------------
// Unitless values are used since all font sizes
// should be converted to rem units with a pixel
// fallback via the .rem() mixin.
@print-font-size: 10; // Desired body font size, when printing, in pts.
// VARIABLES
// --------------------------------------------------
// 1. Fonts
// 2. Typography
// 3. Layout Structure, Sizes & Spacing
// - Breakpoints
// - Media Queries
// - Z-Index Scale
// 4. Elements and Components
from datetime import date
from django.db import models
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.http import HttpResponse
from django import forms
from wagtail.wagtailcore.models import Page, Orderable
from wagtail.wagtailcore.fields import RichTextField, StreamField
from wagtail.wagtailadmin.edit_handlers import FieldPanel, FieldRowPanel, MultiFieldPanel, \
class PageSection(models.Model):
columns = models.IntegerField(
default=1,
help_text="On a full-size display, how many columns would you like?"
)
section_title = models.CharField(
max_length=255,
blank=True,
null=True,
help_text="Allows you to created a headline above your blocks of content (optional)."
@tBaxter
tBaxter / gist:5556564
Last active December 17, 2015 05:18
Connecting SASS @content named media queries to JS.
body {
&:after { display: none; }
@include breakpoint(s) { &:after { content: 'small'; } };
@include breakpoint(m) { &:after { content: 'medium'; } };
@include breakpoint(l) { &:after { content: 'large'; } };
}
@tBaxter
tBaxter / gist:4646085
Created January 27, 2013 03:25
Simple Django form.as_p styling I use
.boxedform {
border:1px solid $base_alt2;
margin-bottom:1em;
@include radius(.5em);
> h2 {padding:.5em 10px 0; color:$accent_alt; font-weight:bold; text-transform: uppercase}
p {
border-bottom:1px dotted $base_alt2;
padding:.5em 0;
margin-bottom:0;
<nav>
<ul role="tablist" class="tab-type"> <!-- we can use the role tablist rather than data-tabs -->
<li><!-- see note 1 -->
<a href="#panel1" role="tab" aria-controls="panel1" aria-selected="true">Tab 1< /a><!--see notes 2, 3 and 4 -->
</li>
<li><a href="#panel2" role="tab" aria-controls="panel2" aria-selected="false">Tab 2< /a></li><!-- see note 5 -->
</ul>
</nav>
...
<section id="panel1" role="tabpanel">
import requests
from bs4 import BeautifulSoup
archive_guitar_url = 'http://web.archive.org/web/20140625050804id_/http://gretschpages.com/guitars/'
r = requests.get(archive_guitar_url)
soup = BeautifulSoup(r.text)
guitar_grid = soup.find("section", {"id":"grid"})
guitar_grid_children = guitar_grid.find_all('div')
... extracted the guitar families, now looking at the first of guitar_grid_children to extract models:
.callout-grid.divided{data: {columns:4}}
a href{detail_path}
name stuff
a href{case list}
case list stuff
etc