Skip to content

Instantly share code, notes, and snippets.

View thefotios's full-sized avatar
💭
definitely snacking

Fotios Lindiakos thefotios

💭
definitely snacking
View GitHub Profile
@thefotios
thefotios / tax_stuff.md
Last active August 18, 2023 20:07
tax stuff

tax_category_name array_agg Amino Acids {"Sample Kit - Plant Protein","Sample Kit - Super Plants","Whey Protein - Chocolate Tub (Unpersonalized)","Whey Protein - Chocolate Tub","Sample Kit - Vanilla Protein","Sample Kit - Whey Protein","Sample Kit - Chocolate Protein","Whey Protein - Vanilla Tub (Unpersonalized)","Whey Protein - Chocolate Sachet","Plant Protein - Chocolate Sachet","Plant Protein - Chocolate Tub","Plant Protein - Chocolate Tub (Unpersonalized)","Plant Protein - Unflavored Sachet","Plant Protein - Unflavored Tub","Plant Protein - Unflavored Tub (Unpersonalized)","Plant Protein - Vanilla Sachet","Plant Protein - Vanilla Tub","Plant Protein - Vanilla Tub (Unpersonalized)","Whey Protein - Vanilla Tub","Whey Protein - Vanilla Sachet"}"

Herbal Supplements {Turmeric,"Milk Thistle",Cranberry,Garlic,"Cranberry 2","Ashwagandha 3 (Vegan)","Ashwagandha Bottle (Vegan)",Ashwagandha,"American Ginseng","Maca Sachet",Rhodiola,"Rhodiola 2","Rhodiola 3","Rhodiola 3 Alternative","Rhodiola 3 (Alternative)","Rhodi

@thefotios
thefotios / preamble.md
Created August 17, 2023 14:28
Test YAML preamble
foo baz
bar
zing

This document has a preamble of

---
foo: bar
baz: zing
it 'creates the credits to the user' do
expect(
order.user.store_credits.where(category: MultiMonthCommit.store_credit_category).map(&:amount),
).to match_array(expected_credits)
end
@thefotios
thefotios / visualize_query.rb
Created January 18, 2022 22:27
Format and visualize AR queries using https://explain.dalibo.com
class VisualizeQuery
# Takes an AR relation (query), runs explain, and then uploads it to
# https://explain.dalibo.com for better visualization
#
# The query is also nicely formatted before visualizing using https://github.com/darold/pgFormatter
# - This is run via `docker`
# - If the placeholders are sensitive (for instance emails in a 'where' clause)
# you can pass `anonymize: true` and they'll be replaced with random strings
method_object :query, [title: nil, anonymize: false]
@thefotios
thefotios / verified_double_extensions.rb
Last active July 31, 2020 16:04
Allow instance_double's to pass class equivalence checks (see https://github.com/rspec/rspec-mocks/issues/794)
module VerifiedDoubleExtensions
CLASS_EQUIVALENCE_FUNCTIONS = %i[is_a? kind_of? instance_of?].freeze
def verified_double(klass, *args)
instance_double(klass, *args).tap do |dbl|
CLASS_EQUIVALENCE_FUNCTIONS.each do |fn|
allow(dbl).to receive(fn) do |*fn_args|
klass.allocate.send(fn, *fn_args)
end
end

Backpopulation Time

@thefotios
thefotios / TCP Socket Availability.carbide.md
Last active August 25, 2016 20:10
TCP Socket Availability

TCP Socket Availability

{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"PublicSubnet": {
"Description": "Subnet ID for use by all public agent nodes",
"MaxLength": "18",
"ConstraintDescription": "must be a valid CIDR.",
"Default": "0.0.0.0/0",
"AllowedPattern": "^([0-9]+\\.){3}[0-9]+\\/[0-9]+$",
"MinLength": "9",
@thefotios
thefotios / .node-version
Last active December 11, 2015 22:23
Advent
4.2.2