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 / 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 / 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 / jumpcutter.md
Created July 14, 2021 16:19 — forked from esa1975/jumpcutter.md
Using jumpcutter to trim silence from videos

jumpcutter - Remove silence from videos

Introduction

One of the most time consuming aspects of editing videos for me is removing silence. I tend to create an outline for a video which I refer to as I record but inevitably have to think as I go which leads to pauses. It can dramatically increase the length of a video and I try to keep mine as short as I can.

I capture an average of two to three times the length of a finished video in raw footage that I then need to edit down. The editing process can take many hours depending on the amount of footage. Anything I can do to reduce that time is huge, not only in time saved but in reducing fatigue and overall making the process much less taxing and enjoyable (this is supposed to be fun!).

@lcuevastodoit
lcuevastodoit / application_helper.rb
Created June 30, 2021 02:36 — forked from mynameispj/application_helper.rb
Rails - Easy "active" classes for menu links in Rails
module ApplicationHelper
def current_class?(test_path)
return 'active' if request.path == test_path
''
end
end
@lcuevastodoit
lcuevastodoit / markdown.md
Created June 17, 2021 18:35 — forked from rastasheep/markdown.md
MiniTest quick reference

MiniTest::Spec

use must for positive expectations and wont for negative expectations.

  • must_be | list.size.must_be :==, 0
  • must_be_close_to | subject.size.must_be_close_to 1,1
  • must_be_empty | list.must_be_empty
  • must_be_instance_of | list.must_be_instance_of Array
  • must_be_kind_of | list.must_be_kind_of Enumerable