Skip to content

Instantly share code, notes, and snippets.

View lcuevastodoit's full-sized avatar
✔️
Verified

LUIS CUEVAS lcuevastodoit

✔️
Verified
  • Bogota DC, Colombia
View GitHub Profile
@lcuevastodoit
lcuevastodoit / create-ruby-gem-that-adds-rake-tasks.md
Created October 17, 2023 22:23 — forked from ntamvl/create-ruby-gem-that-adds-rake-tasks.md
How to create a Ruby gem that adds Rake tasks

How to create a Ruby gem that adds Rake tasks

Create a gem

One way to do this is to use bundler to scaffold our gem:

bundler gem my_gem

Add rake tasks to our gem

I prefer to put tasks meant to manage the gem itself in lib/tasks, and tasks the gem is meant to provide to gem users in lib/my_gem/tasks.

@lcuevastodoit
lcuevastodoit / repo-reset.md
Created January 21, 2023 01:55 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@lcuevastodoit
lcuevastodoit / update-rbenv-rubygems.sh
Last active December 5, 2022 16:35 — forked from gshutler/update-rbenv-rubygems.sh
Update Rubygems for all rbenv rubies
#! /usr/bin/env bash
set -e
eval "$(rbenv init -)"
for version in `rbenv whence gem`; do
rbenv shell "$version"
echo "Updating rubygems for $version"
gem update --system --no-document --quiet
def logDirectory = "${thb.settings.thbHome}/logs"
log4j = {
appenders {
file name: "file", threshold: Level.ERROR, file: "${logDirectory}/${appName}-error.log".toString()
file name: "infoFile", threshold: Level.INFO, file: "${logDirectory}/${appName}-info.log".toString()
console name: "stdout", threshold: Level.DEBUG
}
root {
error 'file'
log.debug('Esto es un mensaje de depuración')
log.info('Esto es un mensaje de información')
log.error('Esto es un mensaje de error')
@lcuevastodoit
lcuevastodoit / grails-logging.md
Created October 19, 2022 22:44 — forked from dellermann/grails-logging.md
Shows how to enable logging for Grails database connections.

Full stack traces

To enable full stack traces just add the command line argument -Dgrails.full.stacktrace=true when calling grails, e. g.:

grails -Dgrails.full.stacktrace=true run-app

SQL logging

@lcuevastodoit
lcuevastodoit / DebugFilters.groovy
Created October 19, 2022 21:44 — forked from eliotsykes/DebugFilters.groovy
Grails Debug Filter - log requests
// Put me in grails-app/conf/DebugFilters.groovy
class DebugFilters {
def filters = {
all(controller:'*', action:'*') {
before = {
log.error "${request.method}: $request.forwardURI $request.params"
}
after = { Map model ->
@lcuevastodoit
lcuevastodoit / a_vscode_ror_debugger_setup_with_webpack_dev_server_autolaunch.md
Created September 28, 2022 23:49
Setup Visual Studio Code Ruby on Rails debugger with webpack-dev-server autolaunch

Visual Studio Code Ruby on Rails debugger with webpack-dev-server autolaunch

  1. Both files needs to be specified for every workspace
  2. Install gem ruby-debug-ide gem install ruby-debug-ide
  3. If using rvm make sure to have correctly setup paths or open workspace from terminal with code .
  4. With rbenv everything should work out of the box
  5. You can now run rails server with pressing button (or ctrl+shift+d) and webpack-dev-server will start automatically on background.

Notes: Please note, when you stop debug server, webpack-dev-server remain running in terminal (because it's background job).

@lcuevastodoit
lcuevastodoit / datatables.js
Created June 12, 2022 02:45 — forked from bodrick/datatables.js
esbuild and datatables.net
import $ from 'jquery'
window.jQuery = window.$ = $
import JSZip from 'jszip'
window.JSZip = JSZip
import 'pdfmake'
import dataTable from 'datatables.net-bs4'
dataTable(window, $)
import buttons from 'datatables.net-buttons-bs4'
buttons(window, $)
import columnVisibility from 'datatables.net-buttons/js/buttons.colVis.js'