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
| 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
| 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 |