Skip to content

Instantly share code, notes, and snippets.

View JuanitoFatas's full-sized avatar
🍔

Juanito Fatas JuanitoFatas

🍔
View GitHub Profile
@JuanitoFatas
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]
jobs:
build:
runs-on: ubuntu-latest
env:
RAILS_ENV: test
@JuanitoFatas
JuanitoFatas / rails-diff.sublime-snippet
Created April 13, 2016 07:39
Generate rails old_version..new_version diff sublime snippet
<snippet>
<content><![CDATA[
Upgrade rails from ${1:old_version} to ${2:new_version}.
- Updated: [rails](http://github.com/rails/rails), [${1:old_version}...${2:new_version}](https://github.com/rails/rails/compare/v${1:old_version}...v${2:new_version})
- Updated: actionmailer, ${1:old_version}...${2:new_version} ([CHANGELOG](https://github.com/rails/rails/blob/v${2:new_version}/actionmailer/CHANGELOG.md))
- Updated: actionpack, ${1:old_version}...${2:new_version} ([CHANGELOG](https://github.com/rails/rails/blob/v${2:new_version}/actionpack/CHANGELOG.md))
- Updated: actionview, ${1:old_version}...${2:new_version} ([CHANGELOG](https://github.com/rails/rails/blob/v${2:new_version}/actionview/CHANGELOG.md))
- Updated: activejob, ${1:old_version}...${2:new_version} ([CHANGELOG](https://github.com/rails/rails/blob/v${2:new_version}/activejob/CHANGELOG.md))
- Updated: activemodel, ${1:old_version}...${2:new_version} ([CHANGELOG](https://github.com/rails/rails/blob/v${2:new_version}/activemodel/CHANGELOG.md))
@JuanitoFatas
JuanitoFatas / README.md
Created December 18, 2015 04:11 — forked from fnichol/README.md
A Common .ruby-version File For Ruby Projects

A Common .ruby-version File For Ruby Projects

Background

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
JuanitoFatas / deppbot.md
Last active December 25, 2015 02:45
What is www.deppbot.com? Why bundle update?
@JuanitoFatas
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"; GetProcessMem.new.mb
@JuanitoFatas
JuanitoFatas / heroku-time-zone.md
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) # https://github.com/basecamp/local_time

# 4/16
= f.input :create_date, as: :string, input_html: { value: f.object.create_date && l(f.object.create_date, format: :long) }
@JuanitoFatas
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
rvm:
- 2.3
- 2.2
- 2.1
- 2.0
- 1.9.3
@JuanitoFatas
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
end
def slow