Skip to content

Instantly share code, notes, and snippets.

View julik's full-sized avatar
💭
🎺

Julik Tarkhanov julik

💭
🎺
View GitHub Profile
## STANQUETTE
### INDIVIDUAL CONTRIBUTOR LICENSE AGREEMENT
Thank you for your interest in contributing to the open source projects of Stanquette (“Stanquette”). In order to clarify the intellectual property license granted with Contributions from any person or entity, Stanquette must have a Contributor License Agreement ("Agreement") on file that has been signed by each Contributor, indicating agreement to the license terms below. This Agreement is for your protection as a Contributor as well as the protection of Stanquette; it does not change your rights to use your own Contributions for any other purpose.
You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Stanquette. Except for the licenses granted herein to Stanquette and recipients of software distributed by Stanquette, You reserve all right, title, and interest in and to Your Contributions.
#### Definitions
/*
Encapsulates a number of event handlers that should later
at some point be released. Useful for attaching blocks
of complex interactions to elements or to `document` and then detaching
them in bulk when the component/UI that they are serving is
unmounted or disconnected.
connect() {
this.evm = new EventListenerManager();
// ....
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "async"
gem "ferrum"
gem "state_machines"
gem "breaker_machines"
gem "concurrent-ruby"
gem "nokogiri"
@julik
julik / timetracker.js
Last active June 11, 2025 13:02
Generate a timesheet from Apple Calendar
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 }},
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
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 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',
@julik
julik / styled_templates.rb
Last active April 22, 2025 09:29
styled_templates.rb
# <%= 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>
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|
#!/usr/bin/env ruby
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'premailer'
gem 'nokogiri'
gem 'base64'
gem 'mail'