Skip to content

Instantly share code, notes, and snippets.

View emaraschio's full-sized avatar
🏠
☕ 🤓

Ezequiel Maraschio emaraschio

🏠
☕ 🤓
View GitHub Profile
@emaraschio
emaraschio / SOLID.markdown
Last active May 24, 2023 07:18
SOLID Principles with ruby examples

#SOLID Principles with ruby examples

##SRP - Single responsibility principle A class should have only a single responsibility.

Every class should have a single responsibility, and that responsibility should be entirely encapsulated. All its services should be narrowly aligned with that responsibility, this embrace the high cohesion.

##OCP - Open/closed principle Software entities should be open for extension, but closed for modification.

import ApolloClient, { FetchPolicy } from "apollo-client"
import { HttpLink } from "apollo-link-http"
import { InMemoryCache, NormalizedCacheObject } from "apollo-cache-inmemory"
// import { setContext } from "apollo-link-context"
import ActionCable from "action-cable-react-jwt"
import ActionCableLink from "graphql-ruby-client/dist/subscriptions/ActionCableLink"
import { ApolloLink } from "apollo-link"
import { handleAuthentication, refreshToken } from "utils/oauth"
import { Observable } from "apollo-link"
import { onError } from "apollo-link-error"
● Comandos Para Jugar Como YO:
cl_updaterate "100"
cl_cmdrate "105"
cl_cmdbackup "2"
rate 1000000
ex_interp "0.01"
cl_shadows "0"
gl_fog "1"
cl_weather "0"
@emaraschio
emaraschio / get_title.rb
Created March 22, 2018 19:45
get_title.rb
require 'open-uri'
p = Nokogiri::HTML(open('http://vue-js-modal.yev.io/'))
puts p.title
@emaraschio
emaraschio / order_array.rb
Created April 15, 2015 23:09
Array sort with Ruby
def new_sort(left_sorted, right_sorted)
ordered_array = []
left = 0
right = 0
loop do
break if right >= right_sorted.length and left >= left_sorted.length
if right >= right_sorted.length or (left < left_sorted.length and left_sorted[left] < right_sorted[right])
ordered_array << left_sorted[left]
@emaraschio
emaraschio / player.rb
Last active June 1, 2017 20:52
Ruby Warrior Game
class Player
def play_turn(warrior)
@warrior = warrior
@health ||= warrior.health
@direction ||= :forward
warrior_feel = @warrior.feel @direction
if enemy_ahead?
@warrior.shoot!
elsif warrior_feel.empty?
@emaraschio
emaraschio / Ruby Test Info
Created October 16, 2014 22:19
A few links about Testing with Ruby
Libraries:
http://cukes.info/
http://jnicklas.github.io/capybara/
https://github.com/teampoltergeist/poltergeist
http://phantomjs.org/
How to:
http://www.railsonmaui.com/tips/rails/capybara-phantomjs-poltergeist-rspec-rails-tips.html
https://github.com/teampoltergeist/poltergeist#installing-phantomjs
@emaraschio
emaraschio / jsconfar_2014.markdown
Last active April 30, 2017 17:10
My notes about JS Conf Arg 2014