Skip to content

Instantly share code, notes, and snippets.

Francisco Javier fgarcia

Block or report user

Report or block fgarcia

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
fgarcia / ajv.js
Last active Feb 13, 2019
Central definition schema with AJV + dynamic definitions
View ajv.js
// Objective: Define all schema definitions within a single schema '$id: core'
// + add definitions dynamically
it.only('extend Ajv definitions', async () => {
let res
let core1 = {
$id: 'core',
definitions: {
first: {
type: 'object',
fgarcia /
Last active Jan 22, 2019
Composition Root and Service Locator

If a program needs to make an API call, it is very likely that there is an ApiClient class to make http requests.

let api = new ApiClient('')
let bank = new BankFacade(api)

Since I consider an http request as something very basic in any app, I like having this in my runtime

fgarcia / output.txt
Last active Oct 7, 2017
Reset EventEmitter2
View output.txt
> node test.js
Start test
Start test
View gist:c232f12da4e7e99899a72d78982938ce
> npm --version
> node --version
> jest --debug
jest version = 15.1.1
test framework = jasmine2
config = {
View gist:792add55aee5751ef32b

Should a dry type behave more like a Hash?

Goal: ease transition / refactoring of existing code base

Functions like .keys, .values, .map are missing

Having them would make Dry Structs/Values a perfect drop-in replacement for Hash objects

Maybe a standard mixin to "extend this dirty functionality" would be great Any reason why those functions are not provided? It would be the most Ruby idiomatic

fgarcia / gist:61ae715aa5d8c3bcf2a3
Created Apr 26, 2015
multiple #yard gems #ruby
View gist:61ae715aa5d8c3bcf2a3
libraries = {}
gems = %w(poconf)
gems.each do |gem_name|
Gem.source_index.find_name(gem_name).each do |spec|
libraries[] ||= []
libraries[] <<, spec.version.to_s, nil, :gem)
fgarcia / gist:09667f7c88e12ea81412
Last active Aug 29, 2015
Some quick references for Event Sourcing
View gist:09667f7c88e12ea81412
Mathias Verraes is one of my first references for beginners of Event Sourcing, his blog is full of goodness. As starting video:
Some talks of Emanuele DelBono like
For a VERY basic start, Ruby focused:
fgarcia / gist:0d115f9fbe002b5d6922
Created Feb 9, 2015
Play with include vs exclude
View gist:0d115f9fbe002b5d6922
module Temp
def say
p "hi Parent"
class Swap
include Temp
def say
fgarcia / gist:4ce7d571b84d54338e9b
Created Feb 9, 2015
Delegation pitfals vs extend
View gist:4ce7d571b84d54338e9b
require 'delegate'
class Person
def greeting
def speak
fgarcia / gist:80449b6d2754e66f557d
Last active Aug 29, 2015
Hide all Virtus attributes
View gist:80449b6d2754e66f557d
require 'virtus'
module PersonAttributes
include Virtus.module
attribute :name, String
attribute :age, Integer
class PersonModel
You can’t perform that action at this time.