Skip to content

Instantly share code, notes, and snippets.

View massimoselvi's full-sized avatar

Massimo Selvi massimoselvi

View GitHub Profile

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.

@massimoselvi
massimoselvi / machine.js
Last active December 20, 2020 08:08 — forked from sbussard/machine.js
Generated by XState Viz: https://xstate.js.org/viz
/*
* User centric API
* preview: https://xstate.js.org/viz/?gist=6a454e83ee19acb9ab1a79b0657dd60f
*/
// Available variables:
// - Machine
// - interpret
// - assign

AWS Lambda Event Sourcing Architecture

I'd like to have a AWS lambda / event system that allows for a certain kind of flexability, here's what I need.

  • Events come in via HTTP post webhook with headers and body
    1. Store {headers, body} in one main events table where the event is named what the action is e.g. 'orderCreate', this acts as a ledger of events, with the main columns name, data, created_at.
    2. I'd like to build up the state of individual object, in their own table so for orders a table would exist with that name the event of a orderCreated the row is created and subsiquent orderDeleted the row is deleted.
  1. I need a way to tap into this event and trigger some side-effect event, for instance if a orderCreated comes in to the system I also need to fire something when that comes in such as invoiceCreated I need a way to access the stream of all events and subscribe to the orderCreated and fire a invoiceCreated which ideally should repeat this process all over again
@massimoselvi
massimoselvi / add_cloudflare_ips.sh
Created September 24, 2018 07:56 — forked from dduvnjak/add_cloudflare_ips.sh
Add CloudFlare IP addresses to an EC2 Security Group using awscli
# first we download the list of IP ranges from CloudFlare
wget https://www.cloudflare.com/ips-v4
# iterate over the lines in the downloaded file
# make sure to set `--group-id` and `--port`; more details at http://docs.aws.amazon.com/cli/latest/reference/ec2/authorize-security-group-ingress.html
while read p; do aws ec2 authorize-security-group-ingress --group-id sg-e0000000 --protocol tcp --port 80 --cidr $p; done< ips-v4
@massimoselvi
massimoselvi / php-mcrypt-homebrew.md
Created March 8, 2018 09:14 — forked from teroyks/php-mcrypt-homebrew.md
Add PHP mcrypt extension on Mac OS X with Homebrew

You can install the mcrypt PHP extension with homebrew and use it with the standard PHP installation that comes with OS X.

Install mcrypt:

brew install mcrypt

Install the php extension -- this installs the whole php 5.5, but you can still use the system-provided one by default Note: install the version compatible with whatever your OS X PHP version currently is (check with php -v)

brew install homebrew/php/php55-mcrypt

@massimoselvi
massimoselvi / SparkRoleMiddleware.md
Created December 8, 2016 23:39 — forked from dillinghamio/SparkRoleMiddleware.md
Team Role Middleware For Laravel Spark

Team Role Middleware For Laravel Spark

Makes it simple to use Spark's role feature on routes

Route::group(['middleware'=>'role:owner'], function(){
    // owners only
});

Route::group(['middleware'=>'role:member'], function(){
@massimoselvi
massimoselvi / SassMeister-input.scss
Created November 24, 2016 20:14 — forked from davidkpiano/SassMeister-input.scss
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
$scotch-color-key: 'base' !default;
$scotch-colors: (
'primary': (
'base': #8e3329,

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
https://laracasts.com/search?q=polymorphic
https://laracasts.com/search?q=relationships
http://codeplanet.io/laravel-model-relationships-pt-1