Skip to content

Instantly share code, notes, and snippets.

View lindleyw's full-sized avatar

William Lindley lindleyw

View GitHub Profile
@lindleyw
lindleyw / accounting thoughts.markdown
Last active November 27, 2021 08:18
Accounting database thoughts

Given an accounting database where:

  • All changes to the database must be performed by a job posting process
  • The database at the end of each posting will be marked with a GUID
  • Each job posting will be performed through a job queue (e.g., Minion)
  • Each job queue entry will be marked with the starting ("before") and ending ("after") GUID, and optionally, a log of all database modifications (e.g., SQL commands) performed

The following should be true:

  • There will exist an audit trail of postings and modifications to the database in the job queue log
@lindleyw
lindleyw / jstest1
Created March 15, 2018 11:40
Mojo js embed test
#!/usr/bin/env perl
use Mojolicious::Lite;
get '/' => sub {
my $self = shift;
$self->render(template => 'index');
};
app->start;
@lindleyw
lindleyw / gist:a82e9136b12dd6718a3926df878d9eb2
Created December 15, 2017 19:14
View/edit Minion job queue with Yancy
plugin 'Yancy' => {
backend => 'sqlite:' . app->config->{dbname},
collections => {
minion_jobs => {
type => 'object',
properties => {
id => {
type => 'integer',
readOnly => 1,
},
@lindleyw
lindleyw / UserAgent.diff
Created August 18, 2016 16:58
Example patch for handling only known protocols
diff --git a/lib/Mojo/UserAgent.pm b/lib/Mojo/UserAgent.pm
index ebe9537..25f2160 100644
--- a/lib/Mojo/UserAgent.pm
+++ b/lib/Mojo/UserAgent.pm
@@ -84,18 +84,19 @@ sub _connect {
if (my $local = $self->local_address) { $options{local_address} = $local }
$options{handle} = $handle if $handle;
- # SOCKS
- if ($proto eq 'socks') {
@lindleyw
lindleyw / websocket-demo.pl
Last active June 26, 2016 16:27
Mojolicious websocket, with responses interleaved between blocking operations
Mojolicious::Lite;
use Mojo::URL;
# Template with browser-side code
get '/' => 'index';
# WebSocket echo service
websocket '/echo' => sub {
my $c = shift;
@lindleyw
lindleyw / generate-index-from-pod.pl
Last active August 29, 2015 14:22
An example of generating an index, for a complete Perl susbystem like the Mojolicious framework, from its collection of *.pm and *.pod files
#!/usr/env/perl
use Pod::Simple::SimpleTree;
use warnings;
use strict;
use v5.20;
use feature 'signatures';
no warnings 'experimental::signatures';
@lindleyw
lindleyw / README
Last active August 29, 2015 14:03 — forked from scottwalters/README
Hacking (in the original, good sense) for fun and profit since 1977