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 config_data | |
| settings = ActiveSupport::OrderedOptions.new | |
| data = settings.merge!(Rails.application.config_for(:settings).deep_symbolize_keys!) | |
| data_private = data["data_#{self.id}"] | |
| require 'ostruct' | |
| correct = OpenStruct.new data_private | |
| 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
| require 'timeout' | |
| begin | |
| complete_results = Timeout.timeout(1) do | |
| sleep(2) | |
| end | |
| rescue Timeout::Error | |
| puts 'Print me something please' | |
| 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
| require_dependency "lib/exception_database_saver.rb" | |
| config.middleware.use ExceptionDatabaseSaver |
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 'openssl' | |
| def create_fingerprint(string) | |
| key = OpenSSL::PKey::RSA.new 2048 | |
| self.create_fingerprint(OpenSSL::Digest::SHA256.new(key.to_pem).to_s) | |
| string.scan(/../).map{ |s| s.upcase }.join(":") | |
| end | |
| def gen_key(name) | |
| key = OpenSSL::PKey::RSA.new 1048 |
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 Controller | |
| include LazyLoad | |
| def show | |
| @model = Model.find(...) | |
| respond_to do |format| | |
| format.html do | |
| @html_specific_data = Model.find(...) | |
| 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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
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 index | |
| @data = Company.all | |
| respond_to do |format| | |
| format.html | |
| format.json { render :json => @data.to_json } | |
| 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
| https://www.rocketmarketinginc.com/blog/get-never-expiring-facebook-page-access-token/ | |
| additional 3.3.1 |
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
| If you have attempted to install the Nokogiri gem and encountered errors similar to the output below… I feel your pain and have a solution. | |
| The Pain | |
| ➜ z gem install nokogiri Building native extensions. This could take a while... ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension. | |
| /Users/mariozig/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150318-11691-1hlore5.rb extconf.rb | |
| checking if the C compiler accepts ... yes | |
| checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no | |
| Building nokogiri using packaged libraries. | |
| checking for gzdopen() in -lz... yes |
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
| <div data-bind="text: fqdn5() === '' ? 'Default Value' : fqdn5 "></div> |
NewerOlder