Skip to content

Instantly share code, notes, and snippets.

View JuanitoFatas's full-sized avatar

Juanito Fatas JuanitoFatas

View GitHub Profile
JuanitoFatas / build.yml
Last active February 26, 2020 07:32
Example GitHub Actions configurations for a Rails app
# .github/workflows/build.yml
name: Build
on: [push, pull_request]
runs-on: ubuntu-latest
JuanitoFatas / rails-diff.sublime-snippet
Created April 13, 2016 07:39
Generate rails old_version..new_version diff sublime snippet
Upgrade rails from ${1:old_version} to ${2:new_version}.
- Updated: [rails](, [${1:old_version}...${2:new_version}](${1:old_version}...v${2:new_version})
- Updated: actionmailer, ${1:old_version}...${2:new_version} ([CHANGELOG](${2:new_version}/actionmailer/
- Updated: actionpack, ${1:old_version}...${2:new_version} ([CHANGELOG](${2:new_version}/actionpack/
- Updated: actionview, ${1:old_version}...${2:new_version} ([CHANGELOG](${2:new_version}/actionview/
- Updated: activejob, ${1:old_version}...${2:new_version} ([CHANGELOG](${2:new_version}/activejob/
- Updated: activemodel, ${1:old_version}...${2:new_version} ([CHANGELOG](${2:new_version}/activemodel/
JuanitoFatas /
Created December 18, 2015 04:11 — forked from fnichol/
A Common .ruby-version File For Ruby Projects

A Common .ruby-version File For Ruby Projects


I've been using this technique in most of my Ruby projects lately where Ruby versions are required:

  • Create .rbenv-version containing the target Ruby using a definition name defined in ruby-build (example below). These strings are a proper subset of RVM Ruby string names so far...
  • Create .rvmrc (with rvm --create --rvmrc "1.9.3@myapp") and edit the environment_id= line to fetch the Ruby version from .rbenv-version (example below).

Today I learned about another Ruby manager, rbfu, where the author is using a similar technique with .rbfu-version.

JuanitoFatas /
Last active December 25, 2015 02:45
What is Why bundle update?
JuanitoFatas / get_process_mem_repro.rb
Last active August 29, 2015 14:25
Ambiguous first argument warning of get_process_mem
require "get_process_mem";
JuanitoFatas /
Last active September 4, 2015 04:36
Heroku Time Zone Rails 4

I have an date field. Used in two places. They are off by a day with each other when display.

 # 4/15
= local_time(user.create_date) #

# 4/16
= f.input :create_date, as: :string, input_html: { value: f.object.create_date && l(f.object.create_date, format: :long) }
JuanitoFatas / .travis.yml
Last active January 7, 2016 14:08
Sample travis.yml for RubyGems.
language: ruby
bundler_args: --retry=3 --jobs=3
cache: bundler
sudo: false
- 2.3
- 2.2
- 2.1
- 2.0
- 1.9.3
JuanitoFatas / union-array-ampersand-vs-set.rb
Created February 20, 2015 04:03
Union by Array#&, Set#&, and Set#intersection
require 'benchmark/ips'
X = [5, 5, 1, 1]
Y = [1, 2, 5]
def fast
X & Y
def slow