Skip to content

Instantly share code, notes, and snippets.

View haroldofurtado's full-sized avatar

Haroldo Furtado haroldofurtado

View GitHub Profile
root@tw1-server2:~/teste/teste# bundle
Using rake (10.0.4)
Using i18n (0.6.4)
Using minitest (4.7.4)
Using multi_json (1.7.4)
Using atomic (1.1.9)
Using thread_safe (0.1.0)
Using tzinfo (0.3.37)
Using activesupport (4.0.0.rc1)
Using builder (3.1.4)
@haroldofurtado
haroldofurtado / VPS Config
Last active September 10, 2015 13:55 — forked from basmoura/VPS Config
VPS Config
https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04
sudo apt-get update
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvmsudo /usr/bin/apt-get install build-essential nodejs openssl libcurl4-openssl-dev libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison
<!DOCTYPE html>
<html>
<head>
<title>Contabilidade Ortobom</title>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
array = Array.new(10000) { rand(1...5000) }
def most_popular_number(array)
a = array.uniq.map { |e| [e, array.count(e)] }.sort_by { |_, cnt| -cnt }
elements = a.take_while { |_, cnt| cnt == a.first.last }.sort
# Verify if the array is empty.
if array.empty?
puts 'MostPopularNumber array is empty!'
# Verify if there's only one element.
elsif array.size == 1
def calc(x1, y1, x2, y2, x3, y3)
avgx = (x1+x2+x3)/3
avgy = (y1+y2+y3)/3
"#{avgx}, #{avgy}"
end
def isPalindrome(low, high)
while (low < high) do
if (low != high)
return false;
end
low += 1
high -= 1
end
@haroldofurtado
haroldofurtado / .zshrc
Created March 9, 2018 08:52 — forked from zanshin/.zshrc
My .zshrc file
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
#export ZSH_THEME="robbyrussell"
export ZSH_THEME="zanshin"
sgp_demo_2 git:(master) ✗ git push heroku master
Enumerating objects: 87, done.
Counting objects: 100% (87/87), done.
Delta compression using up to 4 threads
Compressing objects: 100% (71/71), done.
Writing objects: 100% (87/87), 25.56 KiB | 2.84 MiB/s, done.
Total 87 (delta 2), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
@haroldofurtado
haroldofurtado / gist:e74fccca1cf48c7301e26c29ecae7eec
Last active August 20, 2019 02:28
Rbenv (configuração básica)
# Verifica as versões do Ruby instaladas
rbenv versions
# Lista as verões do Ruby disponíveis para a instalação
rbenv install -l
# Instala a versão do Ruby desejada
rbenv install <versão>
# Instala a versão do Rails especificando a versão do Ruby
@haroldofurtado
haroldofurtado / rails_setup.md
Created February 27, 2020 16:40 — forked from ryanflach/rails_setup.md
Common setup for a new Rails project
  1. rails new <project_name> -d postgresql --skip-turbolinks --skip-spring -T
  • -d postgresql sets up the project to use PostgreSQL
  • --skip-turbolinks & --skip-spring creates a project that does not use turbolinks or spring
  • -T skips the creation of the test directory and use of Test::Unit
  1. In the Gemfile:
  • Available to all environments:
    • gem 'figaro' - store environment variables securely across your app (docs)
    • Uncomment gem 'bcrypt', '~> 3.1.7' if you will be hosting your own user accounts with passwords (docs)
  • Inside of group :test:
    • gem 'rspec-rails' - user rspec in place of minitest (docs)