Skip to content

Instantly share code, notes, and snippets.

comp615 / ariaTweet.js
Created September 21, 2018 00:36
A basic use case example for when referencing domIds in a label might provide advantages over recreating a string
class Tweet {
render() {
// Visually the order here might make sense because of the squiggles and dots connecting it all
// but to screenreader users, we want to present the information in more of an RSS form that
// makes sense when read aloud. This includes reordering content and skipping reading some action buttons or labels
// unless they drill in or tab through the clickable items. This way they can more quickly consume the feed content.
// Note: because each item has lots of specialized formatting content, it would be hard/duplicative
// to exactly recreate the perfect string here outside of those sub-components
return (<View accessible aria-labelledby='userDomId timeDomId quotedDomId textFormatterDomId visuallyHiddenActivitySummaryDomId'>
comp615 / modalSwitch.js
Created September 21, 2018 00:24
One approach to creating a site-wide modal system with React Router 4+. Relies on routes being evaluated in place to split the location context magically
// Allows a route and screen to just exist, and let's the app figure out if it should be a modal or not
// and manage the background context
comp615 / index.js
Created September 21, 2018 00:11
Example of Aria Management for Typeahead in React Native
class TypeaheadInput extends Component {
constructor() {
this._dropdownDomId = `typeahead-${Math.random()}`;
// This is really fake, but it does need to be bound on the text input
this.state = {
focusedItemIdx: 0
render() {
const focusedItemDomId = `typeaheadItem-${focusedItemIdx}`;
comp615 / emails.rake
Created June 1, 2013 20:56
If you send emails in Ruby on Rails using Gmail as your SMTP, this little rake task will locate all the bounced emails, and reset those users email addresses automatically for you. Emails will remain in your inbox, but will be marked as read once handled. You may want to customize this to do something else, or be more rigorous in which emails ar…
desc "Log in to the Gmail account and cleanse anyone who appears to have bounced"
task :handle_bounces => :environment do
require 'gmail'
# Open a connection using your default smtp settings, could also define via YML or inline
gmail = Gmail.connect!(ActionMailer::Base.smtp_settings[:user_name], ActionMailer::Base.smtp_settings[:password])
# Find everything from the Gmail mailer daemon (unread only)
emails = gmail.inbox.emails(:unread, :from => "", :subject => "Delivery Status Notification (Failure)")"Found #{emails.length} messages")
emails.each do |email|
# Gmail sets a header "X-Failed-Recipients", with each email that failed
comp615 / leaflet_numbered_markers.css
Created April 2, 2012 23:51
Numbered Markers in Leaflet (JS Mapping)
.leaflet-div-icon {
background: transparent;
border: none;
.leaflet-marker-icon .number{
position: relative;
top: -37px;
font-size: 12px;
width: 25px;