Skip to content

Instantly share code, notes, and snippets.

View dorianmariecom's full-sized avatar

Dorian Marié dorianmariecom

View GitHub Profile
@dorianmariecom
dorianmariecom / asdf-plugin-list-all
Created September 13, 2022 09:16
Output of `asdf plugin list all` (all the default URLs of asdf plugins)
1password-cli https://github.com/NeoHsu/asdf-1password-cli.git
R https://github.com/asdf-community/asdf-r.git
act https://github.com/grimoh/asdf-act.git
action-validator https://github.com/mpalmer/action-validator.git
actionlint https://github.com/crazy-matt/asdf-actionlint.git
adr-tools https://gitlab.com/td7x/asdf/adr-tools.git
ag https://github.com/koketani/asdf-ag.git
age https://github.com/threkk/asdf-age
agebox https://github.com/slok/asdf-agebox.git
aks-engine https://github.com/robsonpeixoto/asdf-aks-engine.git
~/s/language> crystal a.rb
FF
Failures:
1) Hash(K, V) equals with symbol
Failure/Error: { :a => 1 }.should eq({ a: 1 })
Expected: {a: 1}
got: {:a => 1}
error in line 1
Error: while requiring "./spec/language_spec.cr"
In spec/language_spec.cr:5:25
5 | language = Language.create do
^-----
Error: instantiating 'Language.class#create()'
convertible_int: checking for convertible type of chtype... -------------------- failed
DYLD_FALLBACK_LIBRARY_PATH=.:/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib "clang -o conftest -I/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/include/ruby-3.1.0/arm64-darwin21 -I/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/include/ruby-3.1.0/ruby/backward -I/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/include/ruby-3.1.0 -I. -I/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unus
# frozen_string_literal: true
class ErrorsService < ApplicationService
def initialize(error:, current_user: nil)
super(current_user: current_user)
@error = error
@class_name = error.record.class.name.to_s.underscore
@query = error.query.to_s.sub("?", "")
end
def response
irb(main):008:0> Search.new(scope: Item.all, query: "(ruby or Ruby) and extras.user:luci
usdomitius", schema: Item::SCHEMA).resolve.pluck(:content)
Item Pluck (17.3ms) SELECT "items"."content" FROM "items" WHERE (to_tsvector(coalesce(id::text, '') || ' ' || coalesce(kind::text, '') || ' ' || coalesce(external_id::text, '') || ' ' || coalesce(external_created_at::text, '') || ' ' || coalesce(title::text, '') || ' ' || coalesce(content::text, '') || ' ' || coalesce(url::text, '') || ' ' || coalesce(created_at::text, '') || ' ' || coalesce(updated_at::text, '') || ' ' || coalesce(extras->>'parent_item_id'::text, '') || ' ' || coalesce(extras->>'context_item_id'::text, '') || ' ' || coalesce(extras->>'next_item_id'::text, '') || ' ' || coalesce(extras->>'user'::text, '') || ' ' || coalesce(extras->>'html'::text, '') || ' ') @@ websearch_to_tsquery('english', 'ruby') OR to_tsvector(coalesce(id::text, '') || ' ' || coalesce(kind::text, '') || ' ' || coalesce(external_id::text, '') || ' ' || coalesce(external_cre
require 'spec_helper'
require 'json'
require 'active_support/all'
require_relative '../../app/models/search_parser'
RSpec.describe SearchParser do
let!(:string) { '' }
subject do
described_class.new.parse(string)
require 'parslet'
class SearchParser < Parslet::Parser
# space, e.g. " " or " "
rule(:space) { match('\s').repeat(1) }
rule(:space?) { space.maybe }
# string, e.g "hello" or ""hello world""
rule(:quote) { str('"') }
rule(:char) { match('.') }
require 'json'
json = JSON.parse(File.read('package.json'))
json['devDependencies'].transform_values! { '*' }
json['optionalDependencies'].transform_values! { '*' }
File.write('package.json', JSON.pretty_generate(json))
SELECT
first_name
FROM
users
LEFT JOIN messages received_messages ON received_messages.from_id = 1
AND received_messages.to_id = users.id
LEFT JOIN messages sent_messages ON sent_messages.from_id = users.id
AND sent_messages.to_id = 1
WHERE
received_messages.id IS NOT NULL