Skip to content

Instantly share code, notes, and snippets.

Working from home

Ismael G Marin C igmarin

Working from home
View GitHub Profile
igmarin / doctor.rb
Created Apr 30, 2020
Doctor model, geocoding and validator of documents
View doctor.rb
class Doctor < ActiveRecord::Base
paginates_per 15
extend FriendlyId
friendly_id :full_name, use: :slugged
belongs_to :city
belongs_to :specialty
has_and_belongs_to_many :subspecialities
validates :document_reference, :city, :name, :address, presence: true
igmarin / flight-api.rb
Created Apr 30, 2020
Module to get connections from flighstats
View flight-api.rb
require 'open-uri'
module FlightAPI
def self.flights_populate(city)
date = ( + 30).strftime("%Y/%m/%d")
json = JSON.parse(open("{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 / magento.log
Created Nov 1, 2019
Magento stock deployment
View magento.log
Found 1 new commit
Building application 'mymagento' (runtime type: php:7.0, tree: 1eebebe)
Generating runtime configuration.
Moving the application to the output directory
Prewarming composer cache.
Found a `composer.json`, installing dependencies.
W: Loading composer repositories with package information
igmarin / not-rails-activerecord.rb
Created Jun 13, 2018
Not in Rails it's not that simple
View not-rails-activerecord.rb
scope :without_instagram_videos, -> { where.not('type = ? AND origin = ?', "Video", "instagram") }
#scope :without_instagram_videos, -> { where("type != ? AND origin != ?", "Video", "instagram") }
#scope :without_instagram_videos, -> { where("type IS DISTINCT FROM ? AND origin IS DISTINCT FROM ?", "Video", "instagram") }
#scope :without_instagram_videos, -> { where(type: ['Gallery', 'Video', 'BlogEntry'], origin: [nil, "oyalaa", "youtube", "5"]) }
View _products.html.haml
- content_for :head do
- if paginated_products.respond_to?(:total_pages)
= rel_next_prev_link_tags paginated_products
%div{ data: { hook: 'products_search_results_heading' } }
- if products.empty?
%div{ data: { hook: 'products_search_results_heading_no_results_found' } }
= t('spree.no_products_found')
- elsif params.key?(:keywords)
%div{ data: { hook: 'products_search_results_heading_results_found' } } t('spree.search_results', keywords: h(params[:keywords]))
igmarin / application_helper.rb
Last active Feb 14, 2018
method_with several links
View application_helper.rb
def login_form_links
links = [sign_in, devise_registration, password_recovery, confirmation_instructions, unlock_email]
if devise_mapping.omniauthable?
resource_class.omniauth_providers.each do |provider|
links << link_to(t('.sign_in_with_provider', provider: OmniAuth::Utils.camelize(provider)), omniauth_authorize_path(resource_name, provider))
links.join(' ')
igmarin / main.c
Last active Sep 3, 2017
Main ejemplo LCD
View main.c
#include <hidef.h> /* common defines and macros */
#include "derivative.h" // Definiciones de la familia del micro
#include <mc9s12c32.h> /******* Definiciones específicas del micro *******/
#include "LCD.H"
#include "PLL.H"
#pragma LINK_INFO DERIVATIVE "mc9s12c32"
igmarin /
Created Feb 17, 2017
Second Activity MagmaHackers

Second Activity

    1. You have to review what your team mates did
    1. Give at least 1 suggestion per project (from design, code review) Those suggestions for he moment will be handled as (Issues on the project that you are reviewing, that option is below the name of the user / name of the project)
    1. Based on the comments that you received give a reply about them or in some cases apply those comments to your project.
    1. You have to pick at least 1 of the the project(s) from your mates and fork it and create "your" version of that project.
    1. Next friday we will have a meeting to review this 2 first weeks and have a review of that (time of the meeting to be determined next week)
igmarin /
Last active Feb 11, 2017
Primer Tarea MagmaHackers

Magma Hackers Assignment #1

Welcome to the first assignment of MagmaHackers, one of the goals of this program it's to grow as a software engineer.

And in this first task we want to know a little bit more about you and also that you get to know your peers

We are going to achieve this goal by creating a personal page

This page it's going to talk about you, you need to create a website with the following requirements