Skip to content

Instantly share code, notes, and snippets.

@goofansu
goofansu / app.js
Last active Jul 23, 2022
LiveView upload directly to AWS China S3
View app.js
let Uploaders = {}
Uploaders.S3 = function (entries, onViewError) {
entries.forEach(entry => {
let xhr = new XMLHttpRequest()
onViewError(() => xhr.abort())
xhr.onload = () => (xhr.status === 200 ? entry.done() : entry.error())
xhr.onerror = () => entry.error()
xhr.upload.addEventListener("progress", event => {
if (event.lengthComputable) {
View ogp.livemd

ogp

Mix.install([
  {:kino, "~> 0.6.1"},
  {:ogp, "~> 1.0"}
])
@goofansu
goofansu / Gemfile
Last active Jan 30, 2022
autoloader loads class unexpectedly in classic mode
View Gemfile
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.6.5'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 6.1.3'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.4'
# Use Puma as the app server
@goofansu
goofansu / Smartblocks.md
Last active May 14, 2022
My daily template on Roam Research. SmartBlocks extension is required, install it on https://roamjs.com/extensions/smartblocks.
View Smartblocks.md
  • #SmartBlock Daily
    • [[Daily Highlight]]
      • <%CURSOR%>
    • Morning Routine
      • {{[[TODO]]}} [[Brain dump]]
      • {{[[TODO]]}} [[Active recall]]
      • {{[[TODO]]}} Morning Brew for news
      • {{[[TODO]]}} Daily review on Readwise
      • {{[[TODO]]}} Read Manning books
  • Evening Routine