Skip to content

Instantly share code, notes, and snippets.

View mvoto's full-sized avatar

Mauricio Voto mvoto

  • Port Coquitlam, BC
View GitHub Profile
@mvoto
mvoto / gist:6226235
Last active December 21, 2015 01:18
Sublime Text User Prefs
{
"theme": "Material-Theme-Darker.sublime-theme",
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
// "theme": "SoDaReloaded.sublime-theme",
// "color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night.tmTheme",
// For Material theme improvement
"overlay_scroll_bars": "enabled",
"line_padding_top": 1,
"line_padding_bottom": 1,
"font_options": [ "gray_antialias" ], // On retina Mac
@mvoto
mvoto / metaprog blog post
Last active December 28, 2015 22:19
This is an initial draft for a blog post
Metaprogramming is not a monster
- Intro:
Every ruby developer should have heard about this topic and 8 from 10 just get scared, probably.
We know that "procs", "lambdas" and "yield" are metaprogramming magic, but there is much more about this 'magic self generating code' land.
I don't want to dive deep into this topic here, just going to talk a little about a daily experience that I've faced and could learn a lot and
be satisfied with metaprogramming, and yes, I figured out that metaprogrammin is not a monster.
- The problem:
We are currently keeping registers on database instead of destroying it, but not all the models and the project also has some dependent destroy associations that behaves this way.
@mvoto
mvoto / gist:8460852
Created January 16, 2014 18:43 — forked from ryansobol/gist:5252653
15 Ruby questions

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@mvoto
mvoto / gist:2a7ff1b6682b279764c6
Created July 29, 2014 13:28
Rails Active Record + Querying References
- Basic Guides(awesome reference):
http://guides.rubyonrails.org/active_record_querying.html
http://guides.rubyonrails.org/active_record_basics.html
- Short Screencast:
http://railscasts.com/episodes/202-active-record-queries-in-rails-3
- More complete guide:
http://www.theodinproject.com/ruby-on-rails#section-advanced-forms-and-active-record
http://www.theodinproject.com/ruby-on-rails/active-record-queries
@mvoto
mvoto / gist:3866cc1c137f533647ef
Created September 26, 2014 13:52
git_ignore_global
[user]
name = Mauricio Voto
email = [email protected]
[core]
excludesfile = /Users/mvoto/.gitignore_global
editor = /usr/bin/vim
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
RAILS_ENV=production rake db:setup
# produces the error below.....hmmm.....it's a no-worky
psql:/yourprojectpath/yourproject/db/structure.sql:29: ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/hstore.control": No such file or directory
# hstore postgresql extension needs to be installed, so....
sudo apt-get install postgresql-contrib
# now your extension should be available to enable so log in with psql
psql -d yourproject_production -U yourdbuser -W
@mvoto
mvoto / gist:3d17d1bdcf1f2291a44a
Created April 16, 2015 19:56
dockerfile: base: ubuntu + nginx, rbenv and ruby 2.2.1
# Ubuntu as the base image
FROM ubuntu:trusty
# Install core tools
RUN apt-get -y update
RUN apt-get -y install git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
# Install nginx
RUN apt-get -y install curl nginx
@mvoto
mvoto / pood_notes.md
Last active January 4, 2016 16:13
Notas sobre o livro Practical Oriented Object Design in Ruby by Sandi Metz

Intro

A leitura deste livro tem como fim o aperfeiçoamento profissional e mudança no modo de enxergar o desenvolvimento. Algumas informações são essenciais para isto, como: boas práticas sempre levam a um bom design de código.

Dicas

  • Single Responsability: Perguntar para a classe sobre seu próprio método, ex.: Carro qual a sua cor ? Isto ajuda a definir se um método faz sentido para a aquela classe, o que ajuda a definir que uma classe deve fazer apenas o que é de sua responsabilidade. Se perguntarmos: Carro qual é a capacidade do seu tanque ? talvez até faça sentido, mas
@mvoto
mvoto / references.md
Last active October 21, 2016 20:52
Telegram Bot Com Elixir - Referências