Scaling Magento presentation with 60 slides and notes, which was then reviewed by Alan Storm.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copy this into the console of any web page that is interactive and doesn't | |
do hard reloads. You will hear your DOM changes as different pitches of | |
audio. | |
I have found this interesting for debugging, but also fun to hear web pages | |
render like UIs do in movies. | |
*/ | |
const audioCtx = new (window.AudioContext || window.webkitAudioContext)() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Controller } from "stimulus" | |
import { DirectUpload } from "@rails/activestorage" | |
import Dropzone from "dropzone" | |
import { getMetaValue, findElement, removeElement, insertAfter } from "helpers" | |
Dropzone.autoDiscover = false | |
export default class extends Controller { | |
static targets = [ "input" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Attachment < ActiveRecord::Base | |
mount_uploader :attachment, AttachmentUploader | |
# Associations | |
belongs_to :attached_item, polymorphic: true | |
# Validations | |
validates_presence_of :attachment |
In this article, I'll walk through a basic Rails (3.2.x) setup for creating a nested resource for two models. Nested resources work well when you want to build out URL structure between two related models, and still maintain a RESTful convention. This code assumes you are running RVM to manage Ruby/Gem versions, and Git for version control.
$ mkdir family # create rvm gemset
$ echo "rvm use --create ruby-1.9.2@family" > family/.rvmrc
$ cd family # install rails
$ gem install rails # create new rails project
$ rails new . # version control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ArticleImageUploader < ImageUploader | |
process :fix_exif_rotation | |
process :strip | |
process :convert => 'jpg' | |
process :quality => 85 # Percentage from 0 - 100 | |
version :gallery_thumb do | |
process :resize_to_fill => Settings.images.article_images.processing.gallery_thumb #44x44 | |
end |