Skip to content

Instantly share code, notes, and snippets.

View brunofrank's full-sized avatar
🏠
Working from home

Bruno Frank brunofrank

🏠
Working from home
  • Frank Labs
  • Uruaçu, GO, Brazil
View GitHub Profile
module Controllers::Crudify
extend ActiveSupport::Concern
included do
before_action :set_super_resource
before_action :set_resource, only: %i[show edit update]
show_search only: :index
show_back only: %i[new edit]
TESTE_DATA = [
["(a[0]+b[2c[6]]) {24 + 53}", true],
["f(e(d))", true],
["[()]{}([])", true],
["((b)", false],
["(c]", false],
["{(a[])", false],
["([)]", false],
[")(", false],
["", false],
gem 'nokogiri, '~> 1.10'
gem 'httparty'
gem 'wasabi'
class SoapEnvelopeBuilder
SCHEMA_TYPES = {
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'
}
SOAP_NAMESPACE = {
1 => { 'soap11' => 'http://schemas.xmlsoap.org/soap/envelope/' },
2 => { 'soap12' => 'http://www.w3.org/2003/05/soap-envelope' }
}
@brunofrank
brunofrank / simple_form_bulma.rb
Created February 17, 2020 14:29 — forked from JuanVqz/simple_form_bulma.rb
Support for simple form with bulma css, copy and paste on config/initializers/simple_form_bulma.rb
# frozen_string_literal: true
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# Default class for buttons
config.button_class = 'button'
# Define the default class of the input wrapper of the boolean input.
config.boolean_label_class = 'checkbox'
@brunofrank
brunofrank / dell-gtx1050-ubuntu-19.04.md
Last active August 13, 2019 13:55 — forked from hereismari/msi-gtx1060-ubuntu-18.04-deeplearning.md
Setting up a Dell laptop with GPU (gtx1050), Installing Ubuntu 19.04

Setting up a Dell laptop with GPU (gtx1050)

Installing Ubuntu 19.04

Installing Ubuntu 19.04

Install (solving issues)

  • Security boot disable (change this in BIOS, for MSI computers reboot system and press delete a couple of times before the OS is loaded)
  • Possible problem: Screen freezing while installing
@brunofrank
brunofrank / numbers_localization.rb
Last active May 17, 2018 21:45
Helps to apply i18n in numbers and money formats
# Put on config/initializers folder
class String
def to_delocalized_decimal
delimiter = I18n::t('number.format.delimiter')
separator = I18n::t('number.format.separator')
self.gsub(/[#{delimiter}]/, '').gsub(separator, '.')
end
def to_delocalized_money
unit = I18n::t('number.currency.format.unit')
class ActiveRecord::Base
def self.has_custom_fields(store_at, *custom_fields)
custom_fields.each.each do |name|
define_method name do
self[store_at][name]
end
define_method "#{name}=" do |new_value|
self[store_at][name] = new_value
@brunofrank
brunofrank / requisitos.txt
Last active March 17, 2018 02:03
Requisitos TDD
Requisitos.
[1]
* Criar uma simples calculadora de strings.
* Deve ter o método int Add(string numbers).
* Este método pode receber 0, 1 ou 2 numeros separados por (,).
[2]
* para string vazias retornar 0.