Skip to content

Instantly share code, notes, and snippets.

View tachyondecay's full-sized avatar

Kara Babcock tachyondecay

View GitHub Profile
@tachyondecay
tachyondecay / datetime-local.py
Last active March 8, 2024 09:18
DateTime WTForms field that assumes input is in local time and converts to UTC for storage
# Requires Arrow package
class DateTimeWidget:
"""Widget for DateTimeFields using separate date and time inputs."""
def __call__(self, field, **kwargs):
id = kwargs.pop('id', field.id)
date = time = ''
if field.data:
dt = arrow.get(field.data).to(current_app.config['TIMEZONE'])
date = dt.format('YYYY-MM-DD')
@tachyondecay
tachyondecay / gist:92e8eb1b24b6f113d3fa
Created June 21, 2015 21:52
Add your own border colour to an embedded Twitter timeline
.twitter-timeline {
border: 1px solid blue !important; /* Replace "blue" with another named colour or hexadecimal color code of your choice. The "!important" flag prevents the inline styling from overriding this rule. */
border-radius: 5px; /* This makes the corners rounded slightly. */
}
@tachyondecay
tachyondecay / gist:4dcc0490a1e3a87e3e84
Created March 30, 2015 01:38
jQuery from CDN with local fallback
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery-1.11.2.min.js"><\/script>')</script>
@tachyondecay
tachyondecay / SassMeister-input.scss
Last active August 29, 2015 14:14
Generated by SassMeister.com.
// ----
// Sass (v3.4.11)
// Compass (v1.0.3)
// ----
// Generates background properties for Cartesian axes in specified quadrant
@mixin axes($q: 1, $bg-colour: rgba(#fff,0.5), $pad: 0.5em) {
// Define pairs for x-axis position. y-axis is always opposite
$x-pairs: ((bottom, right), (bottom, left), (top, left), (top, right));
// Define quadrants in which each axis is inverted
@tachyondecay
tachyondecay / datetimeform.py
Last active April 22, 2022 16:53
DateTimeForm: Combined date/time HTML5 inputs for WTForms
import datetime
from wtforms import Form, StringField
from wtforms.fields.html5 import DateField
from wtforms.widgets.html5 import TimeInput
class TimeField(StringField):
"""HTML5 time input."""
widget = TimeInput()
<user_review>I read math books for fun. I realize that, right away, this puts me in an unusual portion of the population. It’s not &lt;em&gt;just&lt;/em&gt; my fancy math degree that makes these books attractive. However, I do think that there are some math books written for people interested in math (whether professionally or amateurly), and then there are math books written for people who, usually thanks to a bad experience in school, have sworn off math like they said they would swear off cheap booze. &lt;em&gt;Our Days Are Numbered&lt;/em&gt; is one of the latter. In a passionate and personal exploration of shape, algebra, geometry, and number, Jason I. Brown illuminates the fundamental mathematics behind some everyday tasks. While some people will still run away screaming, others will hopefully begin to see math in a new way.&lt;br /&gt;&lt;br /&gt;Among the topics Brown explores are: converting between units, using graphs to display data, the meaning behind averages, the role of chance in decision-makin