Skip to content

Instantly share code, notes, and snippets.

View kirkgo's full-sized avatar

Kirk Patrick kirkgo

  • Kirk Patrick
  • Portugal
View GitHub Profile
@kirkgo
kirkgo / rbenv_macos_bigsur.md
Created May 11, 2021 11:27 — forked from Neutrollized/rbenv_macos_bigsur.md
Installing Ruby with rbenv on MacOS Big Sur

Errors/Problems with Install

In attempting to install Ruby with rbenv, I ran into the following build failures:

BUILD FAILED (macOS 11.2.3 using ruby-build 20210423)

Inspect or clean up the working tree at /var/folders/58/16lnyx815c183j6wzcbl_thc0000gn/T/ruby-build.20210426232453.81982.XfAg0C
Results logged to /var/folders/58/16lnyx815c183j6wzcbl_thc0000gn/T/ruby-build.20210426232453.81982.log

Last 10 log lines:
 ^
@kirkgo
kirkgo / swagger3.json
Created April 12, 2021 20:21
Test - Json
openapi: 3.0.0
info:
version: "1.0.0-oas3"
title: Authentication Server
description: Spring Boot API that delivers authentication server functionality to the users of AutoPacker.
servers:
- url: 'http://dev.libane.tk:8080'
tags:
- name: members
@kirkgo
kirkgo / make_me_diamond_test.rb
Created January 29, 2020 12:29
Diamond Kata using Unit Test
require 'test/unit'
require_relative './make_me_diamond.rb'
class TestMakeMeDiamond < Test::Unit::TestCase
def test_setup
assert_equal(3, 2+1)
end
def test_stop_counter
crafter = MakeMeDiamond.new('D')
@kirkgo
kirkgo / .gitignore
Created December 26, 2016 16:18
Gitignore template for Ruby and Ruby on Rails application. Customize as you need.
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
/.bundle
/log/*
!/log/.keep
@kirkgo
kirkgo / inflector_portuguese.rb
Last active December 26, 2016 16:23
Inflector to pluralize class names to table names in brazilian portuguese.
module Inflector
ActiveSupport::Inflector.inflections do |inflect|
inflect.clear
inflect.plural(/$/, 's')
inflect.plural(/(s)$/i, '\1')
inflect.plural(/^(paí)s$/i, '\1ses')
inflect.plural(/(z|r)$/i, '\1es')
inflect.plural(/al$/i, 'ais')
inflect.plural(/el$/i, 'eis')
@kirkgo
kirkgo / date_conversion.rb
Last active December 26, 2016 16:25 — forked from rafarubert/gist:790860
Convert date format from brazilian portuguese to format accepted by database
def date=(date)
write_attribute(:date, date.gsub(/(\d{4})\/(\d{2})\/(\d{2})/, "#{$3}/#{$2}/#{$1}"))
end
@kirkgo
kirkgo / inflections.rb
Last active June 5, 2018 19:17
Pluralization in brazilian portuguese through REGEX for Ruby on Rails
ActiveSupport::Inflector.inflections do |inflect|
inflect.plural /ao$/i, 'oes'
inflect.singular /oes$/i, 'ao'
inflect.plural /l$/i, 'is'
inflect.singular /is$/i, 'l'
inflect.plural /or$/i, 'ores'
inflect.singular /ores$/i, 'or'
end
@kirkgo
kirkgo / ext_upcase_downcase_method.rb
Last active December 26, 2016 16:28
Change the upcase and downcase method of the ruby ​​String class to handle the change of accented upper and lower case letters.
class String
alias_method :old_upcase, :upcase
def upcase
self.gsub( /\303[\240-\277]/ ) do |match|
match[0].chr + (match[1] - 040).chr
end.old_upcase
end
alias_method :old_downcase, :downcase
def downcase