Skip to content

Instantly share code, notes, and snippets.

View novohispano's full-sized avatar

Jorge Téllez novohispano

View GitHub Profile
class Pony
attr_accessor :hungry
def initialize
@hungry = true
end
def legs
4
end
@novohispano
novohispano / Gemfile
Created September 29, 2015 14:02
ActiveJob Example
source 'https://rubygems.org'
gem 'rails', '4.2.4'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
class ItemSerializer < ActiveModel::Serializer
attributes :id,
:name,
:description,
:image_url,
:created_at,
:updated_at,
:order_count
has_many :order_items
class Api::V1::ItemsController < ApplicationController
respond_to :json, :xml
before_action :authenticate!
 
def index
respond_with Item.all
end
 
def show
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest/pride'
require 'webmock'
require 'vcr'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
class Commitee < OpenStruct
attr_reader :service
def self.service
@service ||= SunlightService.new
end
def self.find_by(params)
service.committees(params).map { |commitee| Commitee.new(commitee) }
end
module Emailery
class Application < Rails::Application
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.mandrillapp.com',
port: 587,
domain: 'example.com',
user_name: 'novohispano@gmail.com',
password: 'ZNrasQmPJPybqX_gsihNdQ',
authentication: 'plain',
@novohispano
novohispano / seed.rb
Last active August 29, 2015 14:28
Seed file data.
class Seed
def self.start
seed = Seed.new
seed.generate_users
seed.generate_items
seed.generate_orders
end
def generate_users
50.times do |i|
@novohispano
novohispano / logic_gates.rb
Last active August 29, 2015 14:22
Logic Gates Code Challenge
module And
class Double
attr_accessor :input_a,
:input_b
def initialize
@input_a = 0
@input_b = 0
end