This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def blah(x, *y, z) | |
| return x, y, z | |
| end | |
| a = blah 1, 'A', 'B', 'C', 'X', 'Y', 'Z', "*" | |
| p a | |
| a.tap { |b| b[1].reverse! } | |
| p a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Rails.application.assets.logger = Logger.new('/dev/null') | |
| Rails::Rack::Logger.class_eval do | |
| alias_method :logger_call, :call | |
| def call(env) | |
| previous_level = Rails.logger.level | |
| #TODO: | |
| #Move paths to yaml file as it grows | |
| paths = %w(/assets/ /my_queues/ /their_queues/) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module SomeLib | |
| module Utilities | |
| module HttpRequest | |
| #send get request to sensor | |
| def send_get_request(url = nil) | |
| send_data url | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SshBase | |
| attr_accessor :host, :username, :password, :timeout | |
| class SSHException < Exception; end; | |
| # Callbacks storage for Channel Execute Callbacks | |
| class ChannelExecCallBacks | |
| attr_accessor :on_success, :on_failure, :on_data, :on_extended_data, :on_close | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| en: | |
| api_responses: | |
| status_codes: | |
| code-200: "Operation successful." | |
| code-400: "Bad Request: The request could not be understood by the server due to malformed syntax." | |
| code-401: "Not Authorized: Either the header did not contain an acceptable Authorization or the username/password was invalid. The server response MUST include a WWW-Authenticate header field." | |
| code-402: "Payment Required: The requested transaction requires a payment which could not be authorized." | |
| code-403: "Forbidden: The server understood the request, but is refusing to fulfill it." | |
| code-404: "Not Found: The server has not found anything matching the Request-URI." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'active_support/concern' | |
| module Concerns | |
| module JobStates | |
| extend ActiveSupport::Concern | |
| def self.extended(base) | |
| base.class_eval do | |
| def self.job_is_pending(id) | |
| update_job id, 1, "Pending" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Devices | |
| module Common | |
| class Reports < Devices::Common::Notifiers; end | |
| class Warnings < Devices::Common::Notifiers; end | |
| class Errors < Devices::Common::Notifiers; end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SiteVariables < YamlToOpenStruct | |
| def initialize | |
| variables_yml = YAML::load(File.open('yaml_location')) | |
| @struct = convert_yml(variables_yml) | |
| end | |
| # send method calls to generated struct | |
| def method_missing(method, *args, &block) | |
| @struct.send(method, *args, &block) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Using the code below as an example | |
| class Employees | |
| include Enumerable | |
| attr_reader :employees | |
| def employees | |
| @employees ||= [] | |
| end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0"?> | |
| <REData> | |
| <REProperties> | |
| <CopyrightNotice/> | |
| <Disclaimer/> | |
| <ResidentialProperty> | |
| <Listing> | |
| <StreetAddress/> | |
| <ListingData> | |
| <REAgent> |
OlderNewer