This file contains 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
"""An all purpose base64 encoder for URLs. | |
It even does emojis! You commonly will use string_to_base64_url and string_from_base64_url. | |
Adapted from https://github.com/supabase-community/base64url-js. | |
""" | |
from collections.abc import Callable | |
BITS_PER_BYTE = 8 |
This file contains 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
{ | |
"device": { | |
"status": { | |
"app": { | |
"version": "2024.02.3", | |
"environment": "production", | |
"build": "2000007077", | |
"hash": "", | |
"timestamp": 1706129539 | |
}, |
This file contains 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 | |
# The rrule gem parses only the recurring rules of the RRULE specification. | |
# That is, the part that comes after "RRULE:" on the last line of an RRULE. To | |
# include the DTSTART, and EXDATE as options to the rrule gem, let's add our | |
# own interface. We remove the "RRULE:" and parse other rules and send them to | |
# the gem with the desired structure. | |
# | |
# Example RRULE which is now parseable as a string: | |
# | |
# EXDATE:19960402T010000Z,19960403T010000Z,19960404T010000Z |
This file contains 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 'dry-struct' | |
require 'active_record' | |
module Types | |
include Dry.Types | |
def self.ArRelation(model_class) | |
# Note that ActiveRecord_Relation, ActiveRecord_Associations_CollectionProxy, and ActiveRecord_AssociationRelation | |
# are private constants - they may change some day | |
Instance(model_class.const_get(:ActiveRecord_Relation)) | |
This file contains 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
defmodule Isbn do | |
require Record | |
Record.defrecord(:isbn, raw: "", gs1: "", group: "", publisher: "", title: "", check_digit: "") | |
end |
This file contains 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 DeployTask | |
attr_accessor :app_suffix, :heroku_app, :git_branch, :force, :enter_maintenance | |
def initialize(options = {}) | |
@app_suffix = options[:app_suffix] | |
@heroku_app = options.fetch(:heroku_app, default_app_name) | |
@git_branch = options.fetch(:git_branch, current_branch) | |
@force = options.fetch(:force, false) | |
@enter_maintenance = options.fetch(:enter_maintenance, true) | |
end |
This file contains 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
#Deploy and rollback on Heroku in staging and production | |
class RakeHerokuDeployer | |
def initialize app_env | |
@app = ENV["#{app_env.to_s.upcase}_APP"] | |
end | |
def run_migrations | |
push; turn_app_off; migrate; restart; turn_app_on; tag; | |
end |