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
var Calendar = Application("Calendar") | |
const calendarName = "My Calendar"; | |
const eventNamePrefix = "Amazing Project 123"; | |
var theCalendar = Calendar.calendars.whose({name: calendarName})[0] | |
var fromDate = new Date(2025, 4, 25) | |
var evts = theCalendar.events.whose( | |
{_and: [ | |
{summary: { _beginsWith: eventNamePrefix }}, |
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
def enter!(readonly: false) | |
Current.site = self | |
@inside = true | |
set_appsignal_tags! | |
@shardine = Shardine.new(connection_config_hash: database_config.merge(readonly:)) | |
@shardine.enter! | |
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
require "digest" | |
require "rack" | |
# This class encapsulates a unit of work done for a particular tenant, connected to that tenant's database. | |
# ActiveRecord makes it _very_ hard to do in a simple manner and clever stuff is required, but it is knowable. | |
# | |
# What this class provides is a "misuse" of the database "roles" of ActiveRecord to have a role per tenant. | |
# If all the tenants are predefined, it can be done roughly so: | |
# | |
# ActiveRecord::Base.legacy_connection_handling = false if ActiveRecord::Base.respond_to?(:legacy_connection_handling) |
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
# This class encapsulates a unit of work done for a particular tenant, connected to that tenant's database. | |
# ActiveRecord makes it _very_ hard to do in a simple manner and clever stuff is required, but it is knowable. | |
# | |
# What this class provides is a "misuse" of the database "roles" of ActiveRecord to have a role per tenant. | |
# If all the tenants are predefined, it can be done roughly so: | |
# | |
# ActiveRecord::Base.legacy_connection_handling = false if ActiveRecord::Base.respond_to?(:legacy_connection_handling) | |
# $databases.each_pair do |n, db_path| | |
# config_hash = { | |
# "adapter" => 'sqlite3', |
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
# <%= style_for_this_template do %> | |
# width: 128px; | |
# .caption { | |
# font-size: 12px; | |
# text-align: center; | |
# } | |
# <% end %> | |
# <div class="<%= css_class_for_this_template %>"> | |
# <div class="title">Hello!</div> | |
# </div> |
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 'bundler/inline' | |
require "logger" | |
gemfile do | |
source 'https://rubygems.org' | |
gem "activerecord", "~> 6", require: "active_record" | |
gem "sqlite3", "~> 1.1" # This has to be of a version activerecord supports, so can't be 2.x | |
end | |
16.times do |n| |
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 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'premailer' | |
gem 'nokogiri' | |
gem 'base64' | |
gem 'mail' |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
.outlinerounded { | |
width: 1px; height: 1px; overflow: hidden; border: 1px solid gray; | |
} | |
</style> | |
</head> | |
<body> |
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 "openssl" | |
require "stringio" | |
class PassthruScheme | |
READ_OR_WRITE_CHUNK_SIZE = 1 << 16 | |
def streaming_encrypt(from_plaintext_io, into_ciphertext_io) | |
while (chunk = from_plaintext_io.read(READ_OR_WRITE_CHUNK_SIZE)) | |
into_ciphertext_io.write(chunk) | |
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 | |
require "test_helper" | |
class BlockwiseEncryptionTest < ActiveSupport::TestCase | |
class NonRandomAccessible | |
def initialize(encryption_key) | |
@algo = "aes-256-cfb" | |
@iv_and_key_length = 16 + 32 | |
@key_derivation_salt = "my desire" |
NewerOlder