Skip to content

Instantly share code, notes, and snippets.

View danielabar's full-sized avatar

Daniela Baron danielabar

View GitHub Profile
@danielabar
danielabar / ruby-3.0.x.patch
Created October 18, 2024 13:39 — forked from nicksieger/ruby-3.0.x.patch
Patch to build ruby-3.0.x on Sequoia
--- ext/bigdecimal/bigdecimal.c.orig 2024-09-25 16:24:50
+++ ext/bigdecimal/bigdecimal.c 2024-09-25 16:25:15
@@ -65,7 +65,7 @@
static ID id_half;
/* MACRO's to guard objects from GC by keeping them in stack */
-#define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
+#define ENTER(n) volatile VALUE vStack[n];int iStack=0
#define PUSH(x) (vStack[iStack++] = (VALUE)(x))
#define SAVE(p) PUSH((p)->obj)
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 || '-') +