Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Ismael G Marin C igmarin

🏠
Working from home
View GitHub Profile
View partners.json
{
"partners": [
{
"partner_id": "eli",
"promo_code": "elizabeth"
},
{
"partner_id": "liz",
"promo_code": "librburnett"
},
@igmarin
igmarin / albums_controller.rb
Created Aug 6, 2015
refom_controller_create
View albums_controller.rb
def create
@album_form = AlbumForm.new(Album.new(songs: []))
if @album_form.validate(params[:album])
@album_form.save do |hash|
Album.create(hash)
end
end
else
render 'new'
@igmarin
igmarin / albums_controller.rb
Created Aug 6, 2015
refom_controller_create
View albums_controller.rb
def create
@album_form = AlbumForm.new(Album.new(songs: []))
if @album_form.validate(params[:album])
@album_form.save do |hash|
Album.create(hash)
end
end
else
render 'new'
@igmarin
igmarin / guess_game.rb
Last active Aug 29, 2015
This a Guess Game in Ruby just for fun and taking the Chap1 in Head First Ruby as a reference :)
View guess_game.rb
class GuessGame
GUESS = 10
def initialize(player_name)
@player_name = player_name
@number = generate_number
@attempts = 1
play
end
def try_to_guess
View index.erb
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>Startup Weekend León</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Startup Weekend muy pronto en tu ciudad">
<meta name="author" content="Gize Bonilla, Ismael G Marín">
<meta property="og:image" content="http://www.swleon.org/images/swleon_facebook.jpg" />
<meta property="og:site_name" content="Startup Weekend León" />
View factura
# == Schema Information
#
# Table name: facturas
#
# id :integer not null, primary key
# account_statement_id :integer
# diverza_client_id :integer
# created_at :datetime(23)
# updated_at :datetime(23)
# file_file_name :string(255)
View id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0Adyhq/cMXC16jM0x6sTMH0pEwFbtpRAWZiUnj3HcffAPfmVmwgV5ES6MUmnWhN0ip+DaAit/CLC+tvN0+gSop/dEQgmQs+xj4Pc60dwPK6eCTuUUsqnuYv/cLcwoft0dha52vcNhvHLjSDR7pwEcWt3pG+PoGd1v0FWDNIV6jUrXm3eTyuBLK7YNkuPuCq8VoVYgLV5Iyc7avHWAaMvIBJ1B31PwuORQwdbszJmVZgvvmOYrxu0jVLBeQbpvpHGIEk5wiKPCGxD/14ATkJMkr5v1FyTTWWjIvznOPf4tXtJwAToH9pirYEzz68WUGXE9l9db2mR/SP/XoiZUJA9h ismael.marin@gmail.com
@igmarin
igmarin / ability.rb
Created Jul 23, 2014
Example Ability
View ability.rb
class Ability
include CanCan::Ability
def initialize(user)
# Mis Modelos: User Publicacion Imagen Galeria Event Departamento Comunicado Ckeditor
user ||= User.new
#El rol de administrador General
if user.role? :admin
can :manage, :all
end
@igmarin
igmarin / flight_api.rb
Created Jun 24, 2014
Module Flight API
View flight_api.rb
require 'open-uri'
module FlightAPI
def self.flights_populate(city)
date = (Date.today + 30).strftime("%Y/%m/%d")
json = JSON.parse(open("https://api.flightstats.com/flex/connections/rest/v1/json/direct/to/#{city.iata_code}/arriving/#{date}?appId=app_id&appKey=api_key").read)
airports = json["appendix"]["airports"]
carriers = json["appendix"]["airlines"]
flights = json["flights"]
flights.each do |f|
@igmarin
igmarin / cities_controller.rb
Last active Aug 29, 2015
Complex Cities Controller
View cities_controller.rb
class CitiesController < ApplicationController
load_and_authorize_resource
before_filter :authenticate_user!, :except => [:participants]
before_filter :load_city, except: [:new, :create]
def new
@city = City.new
@city.build_profile
end
You can’t perform that action at this time.