Skip to content

Instantly share code, notes, and snippets.

class BaseClient
class APINotFound < StandardError; end
attr_reader :auth_strategy
def initialize(auth_strategy: :headers, headers: {})
@auth_strategy = auth_strategy
@headers = headers
end
@danielabar
danielabar / bookmarks_controller.rb
Created June 4, 2024 22:43 — forked from spencerldixon/bookmarks_controller.rb
Real time search with Hotwire
def search
@pagy, @bookmarks = if params[:search].present?
pagy(@bookmarks.search(params[:search]), params: ->(params) { params.merge!({search: params[:search]}) })
else
pagy(@bookmarks)
end
end
function reportError(error, message) {
message = message || '';
console.error(
'ERROR: ' + message + ' [' + error.toString() + ']\n' +
'\nName:\t\t' + (error.name || '-') +
'\nMessage:\t' + (error.message || '-') +
'\nFile:\t\t\t' + (error.fileName || '-') +
'\nSource:\t\t' + ((error.toSource && error.toSource()) || '-') +
'\nLine #:\t\t' + (error.lineNumber || '-') +
'\nColumn #:\t' + (error.columnNumber || '-') +