Skip to content

Instantly share code, notes, and snippets.

View elia's full-sized avatar
🦆
quacking!

Elia Schito elia

🦆
quacking!
View GitHub Profile
diff --git a/Gemfile b/Gemfile
index 09e2601..88f92c8 100644
--- a/Gemfile
+++ b/Gemfile
@@ -70,3 +70,5 @@
gem "selenium-webdriver"
gem "webdrivers"
end
+
+gem "foreman"
@elia
elia / airprint.md
Created January 18, 2022 09:00 — forked from ctborg/airprint.md
Enable Airprint for any printer on MacOs (BigSur)
  1. Connect printer, install printer drivers, and enable Printer Sharing.
  2. Open terminal, run: dns-sd -Z _ipp._tcp. You'll see a few lines of repeated text. Look for your printer's name, next to that record you will see a TXT, copy everything after TXT into a notepad.
  3. In that TXT line, you'll see a line like this: "pdl=application/octet-stream,application/pdf,application/postscript,image/jpeg,image/png,image/pwg-raster" Change that, to add ,image/urf. So it'll look like: "pdl=application/octet-stream,application/pdf,application/postscript,image/jpeg,image/png,image/pwg-raster,image/urf"
  4. Now take that entire TXT line, and add it to this: dns-sd -R "name_to_be advertised" _ipp._tcp.,_universal . 631 URF=none pdl=application/pdf,image/urf YOUR_TXT_STRING
  5. Run that line in the terminal, and Airprint should be enabled.
@elia
elia / upgrading-factory-bot.md
Last active March 29, 2021 17:08
Upgrading FactoryBot on Solidus 2.11+

Updating the factories configuration

Overview

The way Solidus was loading FactoryBot factories up until v2.11 was a hack that worked against Rails reloading and made them substantially incompatible with Spring and other tools, in addition to being at odds with the installation instruction that could be found in the FactoryBot and FactoryBotRails respective READMEs.

What's wrong with the previous setup?

diff --git a/app/backend/beestore/client.rb b/app/backend/beestore/client.rb
index 2e7c8f67d..aa9ccb708 100644
--- a/app/backend/beestore/client.rb
+++ b/app/backend/beestore/client.rb
@@ -380,7 +380,9 @@ module Beestore
# Use this in case you need to restore stocks.
# New 22 Jun 2016.
# Used in VariantAvailabilityRestore (worker, multistock) and Quantifier (multistock in single stock location)
- # stock_locations is an array of stock locations instances.
+ #
@elia
elia / opal-pr-1653.md
Created April 11, 2017 22:11
Opal: constants system rewrite (in two parts) #1653

from: opal/opal#1653

master

commit 447e1b4cb313de4bd416f1184b27fcee8cd5edd8
Author: Elia Schito <elia@schito.me>
Date:   Wed Apr 12 00:00:35 2017 +0200
    Establish a constant lookup IPS benchmark
@elia
elia / init_conf.rb
Last active February 21, 2017 01:15
opal -I. main.rb
module InitConf
# how to add a new parameter
# 1. set the default here
# 2. maintain neatjson options to get it sorted here as well
# 3. update controller_command_defnitions to provide the add / edit commands
# 4. update conf_doc_source.rb to provide the documentation and help
# 5. update config-form.rb to attach a type
# 6. update user-interface.js to add the menu entries
def self.init_conf()
result =
source 'https://rubygems.org'
gem "opal"
require 'opal/deprecations'
# Opal::SimpleServer is a very basic Rack server for Opal assets, it relies on
# Opal::Builder and Ruby corelib/stdlib. It's meant to be used just for local
# development.
#
# For a more complete implementation see opal-sprockets (Rubygems) or
# opal-webpack (NPM).
#
# @example (CLI)
# Remove when https://github.com/rails/sprockets/issues/242 is resolved
unless Rails.env.development?
module SprocketsCachedLoader
def initialize(*)
super
@expanded_assets_cache = {}
end
def asset_from_cache(key)
return @expanded_assets_cache[key] if @expanded_assets_cache.key?(key)
class IO
def read
if @eof
''
else
`res = self.read_proc(@path)`
@eof = true
@lineno = res.size
res
end