- Erich Gamma
- Richard Helm
- Ralph Johnson
- John Vlissides
Es una solución general a un tipo de problema.
| #rspec , minitest cutest librerias | |
| class Juego | |
| GANA = { papel: :piedra, piedra: :tijera, tijera: :papel } | |
| def initialize jugador1, jugador2 | |
| @jugador1 = jugador1 | |
| @jugador2 = jugador2 | |
| end | |
| require 'mqtt' | |
| require 'json' | |
| class Mosca | |
| @@default_broker = "test.mosquitto.org" | |
| @@default_timeout = 5 | |
| @@debug = false | |
| attr_reader :options |
| def verify_phone_pin_and_delete_in_call_records(phone_verification_input) | |
| verified = false | |
| if self.phone_number.nil? && self.is_suspicious && verify_proposed_phone_pin(phone_verification_input) | |
| verified = true | |
| TwilioCall.find_by_user_id(self.id).try(:destroy) | |
| elsif self.proposed_phone_number && verify_proposed_phone_pin(phone_verification_input) | |
| verified = true | |
| TwilioCall.find_by_user_id(self.id).try(:destroy) | |
| elsif !self.proposed_phone_number && verify_phone_pin(phone_verification_input) |
| def validate_user_email_uniqueness | |
| return true if self.skip_user_uniqueness | |
| find = "where(:email => '#{self.email}')" | |
| if self.user_id.present? | |
| find += ".where('id != ?', #{self.user_id})" | |
| end | |
| user = User.class_eval(find) |
| def create_identity_for_existing_user | |
| token = params[:token] # "token" is a better name for a token than "format" | |
| user = User.find_by_email_verification_token(token) | |
| # if you create an association between user and indentinty you dont need to set association | |
| # manually(@identity.user_id = user.id). | |
| @identity = user.identity.build(params[:identity]) | |
| # this part should be moved to a before_save method | |
| # @identity.email = @identity.email_confirmation = user.email | |
| # @identity.user_id = user.id |
| class PahoMessage | |
| constructor: (@message) -> | |
| value: -> | |
| "value: #{ @message }" | |
| topic: -> | |
| "topic: #{ @message }" | |
| paho_message = PahoMessage.new("un mensaje") | |
| console.log paho_message.value |
| #= require paho | |
| freezer = | |
| randomToken: -> | |
| Math.random().toString(36).substr(2) | |
| id: -> | |
| $('body').data('freezer-id').replace(/-/g,"") | |
| domain: -> |