Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View rsmithlal's full-sized avatar

Robert Smith rsmithlal

View GitHub Profile
@rsmithlal
rsmithlal / watermark.rb
Last active January 15, 2020 12:19 — forked from ardianys/watermark.rb
Working Paperclip 4.2.0 watermark processor for Rails 4.x.x and Ruby 2.x.x
# Rails.root /app/models/user.rb
class User
has_attached_file :photo,
styles: {
medium: {
processors: [:watermark],
geometry: "300x300>",
watermark_path: "#{Rails.root}/public/images/watermark.png"
convert_options: { "-strip -auto-orient -colorspace sRGB" } #or whatever options you want
},
@rsmithlal
rsmithlal / notification.js
Created July 19, 2023 14:54
Create and subscribe to Rails API Action Cable for notification on Vue.js 2 app
// app/javascript/channels/notification.js
import consumer from "./consumer";
consumer.subscriptions.create({ channel: "NotificationChannel" }, {
connected() {
console.log("Connected to the notification channel");
},
disconnected() {
console.log("Disconnected from the notification channel");