Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
GitHubbing

Dorian Marié dorianmariefr

💭
GitHubbing
View GitHub Profile
View stacked-orders.sql
select
1
from
deliveries
where
exists (
select
1
from
deliveries deliveries_2
@dorianmariefr
dorianmariefr / asdf-plugin-list-all
Created Sep 13, 2022
Output of `asdf plugin list all` (all the default URLs of asdf plugins)
View asdf-plugin-list-all
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
View result.txt
~/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}
View error.txt
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()'
View mkmf.log
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
View error_service.rb
# 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
View search.txt
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
View search_parser_spec.rb
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)
View search_parser.rb
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('.') }
View loose-dependencies-of-package-json-to-all-versions.rb
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))