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 / 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'
@lcuevastodoit
lcuevastodoit / setup_system_tests_with_rspec_devise_rails6.md
Created June 11, 2022 03:23 — forked from boddhisattva/setup_system_tests_with_rspec_devise_rails6.md
Setup System tests to work with RSpec, Devise and Rails 6

Setting this up took quite a bit of time and research for me, so just thought of sharing the learnings along the way that led to a working setup.

  • Initial error that I was getting with running System tests in Rails 6

    System test integration requires Rails >= 5.1 and has a hard dependency on a webserver and `capybara`, please add capybara to your Gemfile and configure a webserver (e.g. `Capybara.server = :webrick`) before attempting to use system tests.
    • since the error above says specify Capybara in the Gemfile, a part of my Gemfile looked like below:
@lcuevastodoit
lcuevastodoit / gitconfig.sh
Last active April 15, 2022 17:35
Git Fetch from All Branches
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin
git fetch --all
### if you need stash before
git stash
git pull
git stash pop
### if there are conflicts when stash pop
@lcuevastodoit
lcuevastodoit / bash_to_zsh_history.rb
Created March 10, 2022 16:57 — forked from goyalankit/bash_to_zsh_history.rb
Import bash history to zsh history.
#################################################################
# = This script transfers bash history to zsh history
# = Change bash and zsh history files, if you don't use defaults
#
# = Usage: ruby bash_to_zsh_history.rb
#
# = Author: Ankit Goyal
#################################################################
# change if you don't use default values
@lcuevastodoit
lcuevastodoit / gist_markdown_examples.md
Created February 15, 2022 15:27 — forked from ww9/gist_markdown_examples.md
Gist markdown examples

Gist markdown examples

A collection of Markdown code and tricks that were tested to work in Gist.

This and all public gists in https://gist.github.com/ww9 are Public Domain. Do whatever you want with it including , no need to credit me.

Todo

  • Reformat this whole document and assimilate these:
require 'rubygems'
require 'capybara'
require 'capybara/dsl'
require 'capybara/poltergeist'
Capybara.run_server = false
Capybara.current_driver = :poltergeist
Capybara.javascript_driver = :poltergeist
Capybara.app_host = 'http://www.youtube.com'
@lcuevastodoit
lcuevastodoit / gist:5481b8b881801d363b73216a863c3a79
Created January 27, 2022 21:34 — forked from 13k/gist:3086739
Capybara in Rails Console
# rails console test
# # or
# RAILS_ENV=test rails console
require 'capybara/dsl'
Capybara.app = app.instance_variable_get("@app")
cap = Object.new.instance_eval { extend Capybara::DSL; self }
# cap.visit '/'
# cap.page.find 'h1'

Increasing the amount of inotify watchers

If you are not interested in the technical details and only want to get Listen to work:

  • If you are running Debian, RedHat, or another similar Linux distribution, run the following in a terminal:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
@lcuevastodoit
lcuevastodoit / wifi_watch_dog.sh
Created November 4, 2021 19:26 — forked from lovemyliwu/wifi_watch_dog.sh
auto reconnect wifi after kick out by router on ubuntu
#!/bin/bash
check_internet_connection() {
return $(ping -c 1 www.baidu.com > /dev/null)
}
SSID=$1
PW=$2
while [ 1 ]; do
check_internet_connection
@lcuevastodoit
lcuevastodoit / ruby_on_rails_comandos.erb
Last active October 27, 2021 21:02
RUBY ON RAILS COMANDOS
# Para ver los tipos de columnas de un modelo
Model.columns_hash.each {|k,v| puts "#{k} => #{v.type}"}
# debugging de una variable
<%if Rails.env.development?%>
<div class='row'></div>
<div class='col'></div>
<%= debug @contacts%>
<%end%>