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 "faraday" | |
require "json" | |
class BrowserlessApi | |
def initialize(api_key: Rails.application.credentials.dig(:browserless, :api_key) || "<BROWSERLESS_API_KEY>", debug: false) | |
@api_key = api_key | |
@base_url = "https://production-sfo.browserless.io" | |
@debug = debug | |
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 SumsubApi < GenericApi | |
BASE_URL = "https://api.sumsub.com" | |
def initialize(api_token: Rails.application.credentials[:sumsub][:api_token], secret_key: Rails.application.credentials[:sumsub][:secret], | |
base_url: BASE_URL, debug: true) | |
@api_token = api_token | |
@secret_key = secret_key | |
@base_url = base_url | |
@debug = debug |
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
# syntax = docker/dockerfile:1 | |
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile | |
ARG RUBY_VERSION=3.4.1 | |
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base | |
# Rails app lives here | |
WORKDIR /rails | |
# Set production environment |
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 CorporationTax | |
def self.calculate_ct(profit, period_start_on, period_end_on) | |
if period_end_on < Date.new(2023, 4, 1) | |
calculate_ct_before_2023(profit) | |
elsif period_start_on >= Date.new(2023, 4, 1) | |
calculate_ct_after_2023(profit) | |
else | |
period_split = split_periods(period_start_on, period_end_on) | |
period_1_profit = profit * period_split[0] / (period_split[0] + period_split[1]) |
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
module ActiveChildren | |
extend ActiveSupport::Concern | |
included do | |
class_attribute :active_children, default: [] | |
after_save :notify_active_children | |
end | |
class_methods do | |
def has_active_child(name) |
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
#!/usr/bin/env ruby | |
require 'open3' | |
require 'signal' | |
require 'openai' | |
# Define the silence threshold and duration for detection | |
@silence_threshold = '-30dB' | |
@silence_duration = 0.5 |
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 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
class Harvester | |
attr_accessor :output, :links_fetched | |
def initialize(args) | |
super() | |
@options = { |
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
usage: /[... snip ...]/current/script/delayed_job.rb <command> [options] | |
Where <command> is one of start, stop, restart or status | |
[options] are additional options passed to the underlying process |
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
create_table "audit_log_events", :force => true do |t| | |
t.integer "project_id" | |
t.integer "user_id" | |
t.integer "object_id" | |
t.string "object_type" | |
t.string "event_type" | |
t.string "display_string" | |
t.text "data_marshalled" | |
t.datetime "created_at" | |
t.datetime "updated_at" |
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
<%= form_for @email_subscription do |f| -%> | |
<%= f.error_messages :header_message => "Can't subscribe", :message => "This went wrong:" %> | |
<%= f.label :email %> | |
<%= f.text_field :email %> | |
<%= f.label "Your time zone", :for => :time_zone_city %> | |
<%= f.time_zone_select :time_zone_city %> |
NewerOlder