Skip to content

Instantly share code, notes, and snippets.

View 1gor's full-sized avatar

1gor

  • Rational Decisions
  • London
View GitHub Profile
@1gor
1gor / functions.php
Created March 28, 2024 02:09 — forked from butlerblog/functions.php
SMTP using wp-config.php for settings #smtp #wp_mail
<?php // Don't use this line.
/*
* Add the script below to wherever you store custom code snippets
* in your site, whether that's your child theme's functions.php,
* a custom plugin file, or through a code snippet plugin.
*/
/**
* This function will connect wp_mail to your authenticated
@1gor
1gor / gist:338874213ede621b1b5e0203d41bb0a6
Created February 26, 2024 01:33 — forked from viras34/gist:1eed4c8acb2d8996cb5af376644e021f
Automated backups to FTP server using rsync and curlftpfs
Using curlftpfs and FUSE, a ftp site is mapped to the local file system and rsync will backup files to the ftp server automatically.
1. Install required packages
apt-get install curlftpfs rsync
2. Create directory to mount the ftp site
mkdir /mnt/ftpbackup
@1gor
1gor / tailwind_phlex.rb
Created July 16, 2023 23:17 — forked from RomanTurner/tailwind_phlex.rb
POC Tailwind + Phlex component.
class StyledComponent < Phlex::HTML
STYLES = {
container: {
xs: "mx-auto max-w-7xl px-6 py-24",
sm: "sm:py-32",
lg: "lg:px-8"
},
get_started: {
@1gor
1gor / roda_phlex.rb
Created July 16, 2023 16:21 — forked from RomanTurner/roda_phlex.rb
A plugin for Roda for using Phlex as the rendering library of choice.
class Roda
module RodaPlugins
module Phlex
def self.configure(app, opts)
app.opts[:class_name] = app.name
app.opts[:phlex] = opts
end
module InstanceMethods
# Render a component with the default layout.
@1gor
1gor / npm-template.md
Created May 26, 2023 02:09 — forked from scyto/npm-template.md
Nginx Proxy Manager swarm template

Description

This template runs my experimental NPM service as part of evaluating if i should stop using my hand crafted nginx reverse proxy. Note change your passwords and don't use the examples bellow :-) )

State Considerations for SWARM

This container has a database, as such I store the data on the gluster volume. I am currenlty using a mount point to store the voume data on glusterfs. I restrict to 1 instance of each container to avoid database corruption from having two instances. Change example usernames and passwords as needed. leave hostname as db (name resolution works fine using the method)

@1gor
1gor / .spacemacs
Created October 20, 2022 07:32 — forked from odoe/.spacemacs
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@1gor
1gor / rest.el
Created May 7, 2022 16:41 — forked from mbuczko/rest.el
emacs / restclient example
:graphql-url = https://api.github.com/graphql
:github-token := (auth-source-pass-get "token" "web/github")
:headers = <<
Authorization: Bearer :github-token
User-Agent: Emacs
#
:query-repos := <<
@1gor
1gor / 0.Notes.md
Created December 8, 2021 07:25 — forked from C-Duv/0.Notes.md
Example for Docker Swarm, Let's Encrypt and Nginx setup with no Nginx down time (answer to https://twitter.com/developius/status/892470102632923136)
@1gor
1gor / event_sourcing_intro.rb
Created September 17, 2021 07:08 — forked from mottalrd/event_sourcing_intro.rb
An introduction to event sourcing, London Ruby User Group, 9th May 2018
module Commands
module Meeting
AcceptSchema = Dry::Validation.Schema do
required(:user_id).filled
required(:status).value(eql?: :scheduled)
end
class Accept < Command
def call
return validate if validate.failure?

Rough Notes about CQRS and ES

Once upon a time…

I once took notes (almost sentence by sentence with not much editing) about the architectural design concepts - Command and Query Responsibility Segregation (CQRS) and Event Sourcing (ES) - from a presentation of Greg Young and published it as a gist (with the times when a given sentence was heard).

I then found other summaries of the talk and the gist has since been growing up. See the revisions to know the changes and where they came from (aka the sources).

It seems inevitable to throw Domain Driven Design (DDD) in to the mix.