Skip to content

Instantly share code, notes, and snippets.

View wilbert's full-sized avatar

Wilbert Ribeiro wilbert

View GitHub Profile
@wilbert
wilbert / calc.rb
Created October 8, 2023 22:37
Calc Exercise
class Calc
def sum
puts "Digite o primeiro operador"
var1 = gets.chomp
puts "Digite o segundo operador"
var2 = gets.chomp
puts "O resultado é: "
puts var1.to_i + var2.to_i
You can find the Debian version on which your Ubuntu version is based in the file: /etc/debian_version
Ubuntu Debian
19.04 disco buster / sid - 10
18.10 cosmic buster / sid
18.04 bionic buster / sid
17.10 artful stretch / sid - 9
17.04 zesty stretch / sid
16.10 yakkety stretch / sid
16.04 xenial stretch / sid
#------------------------------------------------------------------------------#
# OFFICIAL DEBIAN REPOS
#------------------------------------------------------------------------------#
###### Debian Main Repos
deb http://deb.debian.org/debian/ oldstable main contrib non-free
deb-src http://deb.debian.org/debian/ oldstable main contrib non-free
deb http://deb.debian.org/debian/ oldstable-updates main contrib non-free
deb-src http://deb.debian.org/debian/ oldstable-updates main contrib non-free
# == Flattenator
#
# Author: Wilbert Ribeiro
#
# Ruby is an object-oriented language, that can support other paradigms like 
# functional style of programming.
#
# Flattenator class provides an improved way to flatten ruby arrays with any
# dimension, using functional style to increase performance.
#
@wilbert
wilbert / snippets.cson
Created March 31, 2017 03:07
Generic Ruby Controller Actions Snippet - Atom
'.source.ruby':
'Index Action':
'prefix': 'cai'
'body': """
def index
@$1 = $2.all
respond_with @$1
end
"""
require "rubygems"
require "aws-sdk"
require "pry-nav"
opsworks = Aws::OpsWorks::Client.new(
region: "us-east-1"
)
TrueInstance = Struct.new(:hostname, :private_ip, :layer, :stack)
//
// SoccerRealtimeController.swift
// espnsync
//
// Created by Wilbert Kelyson Gomes Ribeiro on 04/07/15.
// Copyright (c) 2015 ESPN Brasil. All rights reserved.
//
import Foundation
import UIKit
@wilbert
wilbert / normalize_tables_and_columns.rb
Created June 18, 2015 20:20
Normalize table and column names to downcase.
namespace :normalize do
desc "Nomalize table names"
task table_names: [:environment] do
ActiveRecord::Base.connection.tables.each do |table_name|
if table_name.match(/[A-Z]/)
ActiveRecord::Migration.rename_table table_name, table_name.downcase
end
end
end
@wilbert
wilbert / state.js
Created April 7, 2014 20:26
Fill a combox field from a json with cities and neighborhoods when state select changes
jQuery(document).ready(function($){
$("#state_field_id").change(function(e){
$.ajax({
url: "/addresses/cities",
data: {
state_id: $(this).val()
}
}).done(function(data){
$.each(data, function(index, item){
$("#city_field_id").append($('<option />').attr("value", item.id).html(item.name));
@wilbert
wilbert / renamer.rb
Created April 4, 2014 13:46
Parameterieze file names from folder
folder_path = "/Users/wilbert/Desktop/files"
Dir.foreach(folder_path) do |item|
next if item == '.' or item == '..'
filename = File.basename(item, File.extname(item))
File.rename(folder_path + "/" + item, folder_path + "/" + filename.gsub(" ", "-").downcase + File.extname(item))
end