This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
We have an array of objects representing different people in our contacts lists. | |
A lookUpProfile function that takes firstName and a property (prop) as arguments has been pre-written for you. | |
The function should check if firstName is an actual contact's firstName and the given property (prop) is a property of that contact. | |
If both are true, then return the "value" of that property. | |
If firstName does not correspond to any contacts then return "No such contact" | |
If prop does not correspond to any valid properties then return "No such property" | |
*/ | |
//Setup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'elasticsearch/model' | |
module Concerns | |
module Author | |
module Searchable | |
extend ActiveSupport::Concern | |
included do | |
include Elasticsearch::Model | |
include Elasticsearch::Model::Callbacks | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH my_subquery AS (SELECT * FROM table_name WHERE column_name_1 = value_1) | |
SELECT column_name_2 FROM my_subquery | |
WHERE coulumn_date > '2018-12-08' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH my_first_with AS (SELECT foo, c FROM bar) , my_second_with AS ( SELECT foo, c FROM my_first_with) | |
SELECT * FROM my_second_with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO | |
empty_new_table | |
SELECT | |
* | |
FROM | |
(WITH old_table_data AS ( | |
SELECT | |
data1, | |
data2, | |
data3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelectorAll('[data-tooltip-content^="Łukasz Żarski"]').forEach(gownoWartaWiadomosc => {gownoWartaWiadomosc.parentNode.parentNode.parentNode.style.display = "none";}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseService | |
attr_reader :result, :errors | |
def self.call(**args) | |
new(**args).tap(&:call) | |
end | |
def success? | |
errors.blank? | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
desc "example task" | |
task :example_task, [:for_real] => [:environment] do |task, args| | |
ActiveRecord::Base.transaction do | |
# This is the way, do your thing here | |
unless args[:for_real] == "for_real" | |
raise "Discarded all changes. To do a real run invoke this task as follows: | |
bundle exec rake \"#{task.name}[for_real]\"\n" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Dev | |
attr_accessor :level, :money, :tickets | |
def initialize | |
@level = (1..3).to_a.sample | |
@money = 0 | |
@tickets = [] | |
end | |
def take_ticket(ticket) |
OlderNewer