Skip to content

Instantly share code, notes, and snippets.

View rplaurindo's full-sized avatar
🎯
Focusing

Rafael rplaurindo

🎯
Focusing
  • Rio de Janeiro - RJ, Brasil
View GitHub Profile
@rplaurindo
rplaurindo / 1. Running a script.md
Last active June 22, 2021 17:08
Google Apps Script

Openning the Script Editor

With a Google Docs opened, choose

Tools -> Script Editor.

For use the script it must be encapsulated in a isolated (out of a class) function.

Using

Setting up an environment variable

General procedures

  • On tab Advanced click on Environment Variables;
  • Select the environment variable in the "User variables" or "System variables" and click on Edit;

On Windows

  • Click with right button of mouse over My Computer in folder navigator;
@rplaurindo
rplaurindo / git.md
Last active January 10, 2021 04:24

Configurations

git config

Proxy

Use global configuration with --global flag.

$ git config --global https.sslBackend openssl

Working with gems

Generating a new gem structure

$ bundle gem <gem_name>

Adding an owner

$ gem owner <gem> -a <user or email>
@rplaurindo
rplaurindo / Deploying a Rails app using RVM and Passenger.md
Last active May 24, 2018 22:26
Steps to deploy a Rails application with Passenger.

Deploying a Rails Application using RVM and Passenger

Instalations (via APT)

Required packages

  • curl
  • gnupg
  • build-essential
  • git

RVM (Ruby Version Manager)

Required packages

  • sed
  • tar
  • curl
  • gnupg

Import the mpapis Public Key through GPG (GNU Privacy Guard)

Managening users and groups

Creating an user

$ sudo useradd -m <login>

-m option creates a home for it.

Removing an user

@rplaurindo
rplaurindo / Rails task.md
Last active February 25, 2018 23:29
$ rake namespace:task['Hello,Wolrd!']
# lib/tasks/task_example.rake
namespace :namespace_1 do
  # without this line the task will not be enumerated in rake -T
  desc "Description"

  task :task_name, [:params] => [:environment] do |t, arbitrary|
    # it works as splat operator
    params = arbitrary.extras.unshift arbitrary[:params] ? arbitrary[:params] : "no params"

p params

# list generators
$ rails generate

# É importante fazermos algumas considerações para os casos de se trabalhar com namespace:
# O nome do arquivo com _generator.rb deve ter o mesmo nome da classe;
  # sample_generator.rb => class SampleGenerator
  # A classe deve ficar numa pasta com o nome do primeiro módulo;

# lib/generators/error_page/install_generator.rb

module ErrorPage

Generating

Run:

$ rails plugin new <name>

To generate a isolated engine use --mountable

The .rb file generated in folder lib should have the same name of the gem, otherwise it will not load automatically.