Skip to content

Instantly share code, notes, and snippets.

View Joseworks's full-sized avatar

Jose C Fernandez Joseworks

View GitHub Profile
@Joseworks
Joseworks / Chapter_3.rb
Last active August 29, 2015 14:24 — forked from kchens/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
@Joseworks
Joseworks / .gitignore
Last active August 29, 2015 14:25 — forked from octocat/.gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
# 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 November 9, 2015 17:44 — forked from rstacruz/index.md
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@Joseworks
Joseworks / curl.md
Created December 15, 2015 19:13 — forked from btoone/curl.md
A curl tutorial using GitHub's API

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 December 16, 2015 03:36 — forked from SamSamskies/rails_jquery_ajax.md
Rails: jQuery & AJAX Tutorial

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:

@Joseworks
Joseworks / authentication_with_bcrypt_in_rails_4.md
Created December 24, 2015 15:35 — forked from thebucknerlife/authentication_with_bcrypt_in_rails_4.md
Simple Authentication in Rail 4 Using Bcrypt

#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 December 27, 2015 21:01 — forked from sr75/osx-homebrew-setup.md
Mac Yosemite OSX - Homebrew (RVM/MySQL/Redis) setup

Mac Homebrew (RVM/MySQL/Redis) setup

Follow the steps below to setup a local development environment:

XQuartz

Recommended to download latest XQuartz

iTerm2

@Joseworks
Joseworks / 1.never_boolean.md
Created January 24, 2016 15:25 — forked from eddroid/1.never_boolean.md
Ruby Refactorings

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

@Joseworks
Joseworks / rubycas_test.md
Created January 27, 2016 16:52 — forked from simlegate/rubycas_test.md
describe how to spec rubycas with rspec.

rubycas client configuration options in config/envirement.rb
[more details] (https://github.com/rubycas/rubycas-client)

# enable detailed CAS logging
cas_logger = CASClient::Logger.new(::Rails.root+'/log/cas.log')
cas_logger.level = Logger::DEBUG

CASClient::Frameworks::Rails::Filter.configure(
  :cas_base_url  => "https://cas.example.foo/",
  :login_url     => "https://cas.example.foo/login",