defmodule AdventOfCode do
def solve(input, prev \\ -1, acc \\ 0)
def solve([], _, acc), do: acc
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
| api-frontend-api-1 | ╭───────────────────── Traceback (most recent call last) ──────────────────────╮ | |
| api-frontend-api-1 | │ /app/api/middleware/access_logging.py:59 in __call__ │ | |
| api-frontend-api-1 | │ │ | |
| api-frontend-api-1 | │ 56 │ │ ): │ | |
| api-frontend-api-1 | │ 57 │ │ │ try: │ | |
| api-frontend-api-1 | │ 58 │ │ │ │ sender = partial(self._send_with_status_code_recording, │ | |
| api-frontend-api-1 | │ ❱ 59 │ │ │ │ await self.app(scope, receive, sender) │ | |
| api-frontend-api-1 | │ 60 │ │ │ except Exception as e: │ | |
| api-frontend-api-1 | │ 61 │ │ │ │ request["status_code"] = 500 │ | |
| api-frontend-api-1 | │ 62 │ │ │ │ logger.exception(e) |
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
| # db.py | |
| engine = create_engine( | |
| db_config.url, | |
| echo=bool(os.getenv("DEBUG", False)), | |
| hide_parameters=not is_pytest(), | |
| pool_size=db_config.pool_size, | |
| pool_pre_ping=True, | |
| pool_timeout=db_config.pool_checkout_timeout_seconds, | |
| max_overflow=math.ceil(db_config.pool_size * db_config.pool_overflow_fraction), |
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 'pp' | |
| require 'ostruct' | |
| data = File.open('Query Results.csv').map do |l| | |
| pieces = l.tr('{}"', '').strip.split(',', 2) | |
| OpenStruct.new(loan_file_id: pieces[0], all_activities: pieces[1].split(','), all_unique_activities: pieces[1].split(',').uniq) | |
| end | |
| activity_frequency_map = {} | |
| common_subset = [] |
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
| name: Compliance check | |
| on: | |
| pull_request: | |
| types: [opened, edited, reopened, synchronize] | |
| issue_comment: | |
| types: [created, edited, deleted] | |
| jobs: | |
| compliance-check: |
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
| { | |
| "esformatter": { | |
| "allowShebang": true | |
| }, | |
| "plugins": [ | |
| "esformatter-remove-trailing-commas", | |
| "esformatter-collapse-objects", | |
| "esformatter-remove-object-spaces" | |
| ], |
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
| { | |
| "size": 0, | |
| "query": { | |
| "filtered": { | |
| "filter": { | |
| "bool": { | |
| "must": [ | |
| { | |
| "exists": { | |
| "field": "address.full" |
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 ForeignKeyValidator < ActiveModel::EachValidator | |
| def validate_each(record, attribute, value) | |
| unless value && value.to_s =~ /^\d+$/ && value.to_i > 0 | |
| record.errors[attribute] << 'is not a valid foreign key' | |
| end | |
| 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
| class CreditCardController < ApplicationController | |
| def create | |
| creator = CreditCardCreator.call(params) | |
| # creator.respond_to?(:errors) => true | |
| # creator.errors => [] (by default) | |
| # when something goes wrong: creator.errors => ['Terrible Error'] | |
| respond_with(creator) | |
| 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
| $ -> | |
| $("#scared, #down-arrow, #example-button").click -> | |
| $("html, body").animate | |
| scrollTop: $("#dares-photos").offset().top | |
| , 1000 | |
| return false |
NewerOlder