Skip to content

Instantly share code, notes, and snippets.

Avatar

Benoit Caccinolo bcaccinolo

View GitHub Profile
@bcaccinolo
bcaccinolo / convert-line.clj
Created Dec 10, 2020
My first babashka/clojure script
View convert-line.clj
#!/home/benoit/bin/bb
(def argument (first *command-line-args*))
(->> argument
(#(str/split % #", "))
(map #(str "\"" % "\""))
(str/join ", ")
println
)
@bcaccinolo
bcaccinolo / yardoc.md
Last active Oct 11, 2019
Yardoc template
View yardoc.md

Links

Documentation examples

You likely won't use all the available tags (words starting with an @) shown in the bellow examples. These examples are more of a cheat sheet of what you can do and where you can use them.

Modules

View event_on_body🦊.js
body = window.document.getElementsByTagName('body')[0];
body.addEventListener('mouseenter', function(ev) {
ev.preventDefault;
if(ev.target.tagName !== 'TD') {
return;
}
ev.target.className = "bouya";
}, true);
View yardoc_cheatsheet.md

YARD CHEATSHEET http://yardoc.org

cribbed from http://pastebin.com/xgzeAmBn

Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.

Modules

Namespace for classes and modules that handle serving documentation over HTTP

@bcaccinolo
bcaccinolo / gist:51a2ef0d8abc8532b56c23c0c4f5e59c
Created Jul 26, 2018 — forked from vsizov/gist:4500870
Automatically reload gems in rails 5 on every request in development
View gist:51a2ef0d8abc8532b56c23c0c4f5e59c
# Source: http://timcardenas.com/automatically-reload-gems-in-rails-327-on-eve
# Inside config/environments/development.rb
# Do the following after every request to the server in development mode
ActionDispatch::Callbacks.to_cleanup do
# If the gem's top level module is currently loaded, unload it
if Object.const_defined?(:MyCoolGem)
@bcaccinolo
bcaccinolo / __readme.md
Created Jul 26, 2018 — forked from maxivak/__readme.md
Load code in libraries in Rails 5
View __readme.md

Load lib files in production (Rails 5)

If you have your code defined in classes in lib/ folder you may have problems to load that code in production.

Autoloading is disabled in the production environment by default because of thread safety.

Change config/application.rb:

    config.autoload_paths << Rails.root.join("lib")
 config.eager_load_paths &lt;&lt; Rails.root.join("lib")
@bcaccinolo
bcaccinolo / log.php
Last active Feb 19, 2018
log prestashop
View log.php
if (!function_exists('monolog')) {
function monolog($var) {
$log = (new \Monolog\Logger('name'))->pushHandler(new \Monolog\Handler\ErrorLogHandler());
$log->addInfo("Running controller");
}
}
if (!function_exists('filelog')) {
View gist:bb5a3e2c74876b4370d78ea539b27b5e
<type>(<scope>): <subject>
<body>
<footer>
#-------------------------------------------------------------------------------
# <type>
# - feat: A new feature
# - fix: A bug fix
@bcaccinolo
bcaccinolo / settings.py
Created Aug 10, 2017 — forked from palewire/settings.py
My current default Django LOGGING configuration
View settings.py
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler'
},
'null': {
'level':'DEBUG',