AWS S3 now uses JSON for CORS configuration and cors.json
is minimal configuration for Rails 7 direct uploads.
<% flash.each do |type, title| %> | |
<%= render FlashComponent.new(type: type, title: title) %> | |
<% end %> |
<% if flash.any? %> | |
<div class="fixed inset-0 flex items-end justify-center px-4 py-6 pointer-events-none sm:p-6 sm:items-start sm:justify-end z-50" data-flash-notifications='true'> | |
<% flash.each do |msg_type, msg| %> | |
<div x-data="{flashVisible: false, flashType: '<%= msg_type %>'}" x-show='flashVisible' x-init="() => {flashVisible=true; setTimeout(() => {flashVisible=false}, 5000)}" class="max-w-sm w-full bg-white shadow-lg rounded-lg pointer-events-auto" | |
x-transition:enter="transition ease-out duration-300" | |
x-transition:enter-start="translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2" | |
x-transition:enter-end="translate-y-0 opacity-100 sm:translate-x-0" | |
x-transition:leave="transition ease-out duration-100" |
import com.atlassian.jira.component.ComponentAccessor | |
import com.atlassian.jira.event.type.EventDispatchOption | |
import com.atlassian.jira.issue.CustomFieldManager | |
import com.atlassian.jira.issue.MutableIssue | |
import com.atlassian.jira.issue.IssueManager | |
import java.util.ArrayList | |
import com.atlassian.jira.user.ApplicationUser | |
import org.apache.log4j.Logger | |
def log = Logger.getLogger("com.acme.XXX") |
# The initial version | |
if [ ! -f .env ] | |
then | |
export $(cat .env | xargs) | |
fi | |
# My favorite from the comments. Thanks @richarddewit & others! | |
set -a && source .env && set +a |
require 'logger' | |
module Dim | |
class Logger < ::Logger | |
def initialize(*) | |
super | |
@formatter = NoTimestampFormatter.new | |
end | |
end |
Keep list (and count) of online users in a Firebase web app - by isolated rooms or globally.
Firebase Shared Checklist is a demo application that shows the number of users joined a checklist using gathering.js. Here is a 1 minute screencast of using this application.
At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.
git commit --amend
This will open your $EDITOR
and let you change the message. Continue with your usual git push origin master
.
Every ten years, after the decennial census and as mandated by the U.S. Constitution, states are subdivided into sets of congressional districts for representation in the U.S. House of Representatives. GovTrack provides maps of these congressional boundaries for your reference and makes the maps available for embedding on other sites. Beyond looking up the district for a specific address, maps introduce a geographic context that tells us about the demographics and rural/urban nature of a district, as well as whether that district's boundaries show signs of gerrymandering.
Recently, we redesigned GovTrack's map of congressional districts to be more responsive, more legible, and easier to reproduce. To create these maps, we used data from the U.S. Census Bureau, a few cartographic tricks and tools, and web map hosting from Mapbox. I'll explain the process here, and you can reference the exact workflow [on GitHub](https://github.com/aaron
var sanitizeHtml = require('sanitize-html'); | |
function localSanitizeHtml(html) { | |
let allowedAttributes = JSON.parse(JSON.stringify(sanitizeHtml.defaults.allowedAttributes)); | |
allowedAttributes.a = (allowedAttributes.a || []).concat(['data-trix-attachment', 'rel']); | |
allowedAttributes.figure = (allowedAttributes.figure || []).concat(['class']); | |
allowedAttributes.figcaption = (allowedAttributes.figcaption || []).concat(['class']); | |
allowedAttributes.img = (allowedAttributes.img || []).concat(['width', 'height']); | |
allowedAttributes.span = (allowedAttributes.span || []).concat(['class']); |