Skip to content

Instantly share code, notes, and snippets.

View AhmedNadar's full-sized avatar
🌎
Ready to work remote with you 😀 💻 🤝 👏🏼

Ahmed Nadar AhmedNadar

🌎
Ready to work remote with you 😀 💻 🤝 👏🏼
View GitHub Profile
@AhmedNadar
AhmedNadar / 0 AWS Cloud9
Created April 4, 2021 01:45 — forked from yshmarov/0 AWS Cloud9
Ruby on Rails 6: Learn 25+ gems and build a Startup MVP 2020
# All AWS C9 envments
https://eu-central-1.console.aws.amazon.com/cloud9/home?region=us-east-1
# Instance management
https://console.aws.amazon.com/ec2/home?region=eu-central-1#Instances:sort=instanceId
# Create AWS C9 environment
https://eu-central-1.console.aws.amazon.com/cloud9/home/create
Setting - set tabs to 2
@AhmedNadar
AhmedNadar / stimulus.md
Created December 14, 2020 09:00 — forked from mrmartineau/stimulus.md
Stimulus cheatsheet
@AhmedNadar
AhmedNadar / index.md
Created February 13, 2018 21:23 — forked from rstacruz/index.md
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@AhmedNadar
AhmedNadar / gemfile_template.rb
Created December 26, 2016 21:10 — forked from poc7667/gemfile_template.rb
gemfile gems cheat sheet tools
#How to Use rails _4.0.0_ new $1 -m app_tmpl.rb -T --skip-bundle
# rails (4.0.0, 3.2.13, 3.2.12)
require 'ap'
require 'awesome_print'
app_name=@app_name
remove_file "README.rdoc"
create_file "README.md", "TODO"
create_file ".ruby-version"
@AhmedNadar
AhmedNadar / 42-things.md
Created December 26, 2016 08:51 — forked from SabretWoW/42-things.md
42 Sweet, sweet things Rails (and Ruby) can do. Wonderful reference.
---------------------------------------------------------------------------------------------------------
# app/helpers/application_helper.rb
---------------------------------------------------------------------------------------------------------
def horizontal_simple_form_for(record, options={}, &block)
options[:html] ||= {}
options[:html][:class] = "form-horizontal #{options[:html][:class]}".rstrip
options[:wrapper] = :bootstrap_horizontal
simple_form_for(record, options, &block)
end
---------------------------------------------------------------------------------------------------------

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.

aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev

# Update, upgrade and install development tools:
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install build-essential git-core libssl-dev libsqlite3-dev curl nodejs nginx
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
# Add rbenv to the path:
echo 'export RBENV_ROOT=~/.rbenv' >> ~/.bash_profile
# Helpers
def git_update(message)
git :add => ".", :commit => "-m '#{message}'"
end
def git_remove(file)
git :rm => file
end