Skip to content

Instantly share code, notes, and snippets.

Avatar

Jose C Fernandez Joseworks

View GitHub Profile
@Joseworks
Joseworks / contact_batch_email.html.erb
Created Apr 10, 2015
Send batch emails on ActiveAdmin Rails 4.2.0
View contact_batch_email.html.erb
<!-- Contact batch email -->
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
<div>Name: <%= @name %></div>
<br>
<div>Subject: <%= @subject %></div>
View Chapter_3.rb
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Needs to Manage Dependencies
class Gear
attr_reader :chainring, :cog, :rim, :tire
def initialize(chainring, cog, rim, tire)
@chainring = chainring
@cog = cog
@rim = rim
View .gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
View gist:346855cb15f7a4f460de
# define class Dog
class Dog
attr_accessor :breed, :name
def initialize(breed, name)
# Instance variables
@breed = breed
@name = name
end
@Joseworks
Joseworks / index.md
Created Nov 9, 2015 — forked from rstacruz/index.md
Rails models cheatsheet
View index.md

Rails Models

Generating models

$ rails g model User

Associations

belongs_to
has_one
@Joseworks
Joseworks / curl.md
Created Dec 15, 2015 — forked from btoone/curl.md
A curl tutorial using GitHub's API
View curl.md

Introduction

An introduction to curl using GitHub's API

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@Joseworks
Joseworks / rails_jquery_ajax.md
Created Dec 16, 2015 — forked from SamSamskies/rails_jquery_ajax.md
Rails: jQuery & AJAX Tutorial
View rails_jquery_ajax.md

jQuery and jQuery-ujs

When using Rails 3.0 and later we already get jquery-rails for free. Look in the gemfile and you'll see:

gem "jquery-rails"

You can view the full documentation here: source: https://github.com/indirect/jquery-rails

If you take a look in APP_DIR/app/assets/javascripts/application.js, you'll notice the following lines of code:

View authentication_with_bcrypt_in_rails_4.md

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault

##Steps

@Joseworks
Joseworks / osx-homebrew-setup.md
Created Dec 27, 2015 — forked from sr75/osx-homebrew-setup.md
Mac Yosemite OSX - Homebrew (RVM/MySQL/Redis) setup
View osx-homebrew-setup.md

Mac Homebrew (RVM/MySQL/Redis) setup

Follow the steps below to setup a local development environment:

XQuartz

Recommended to download latest XQuartz

iTerm2

View 1.never_boolean.md

Never Boolean

You hardly ever have to use the word true in your code.

if (something == true)
  # do something cool
end

Can be rewritten as

You can’t perform that action at this time.