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 NuregoConnector | |
| class Billing | |
| def self.provider=(some_provider) | |
| @@provider = some_provider.new | |
| end | |
| def self.provider | |
| @@provider | |
| 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
| CLIENT_SECRET = '2057f37a2b5275ef1ecf8f93c8e88628ded594ce' | |
| #this is the data from encrypt.rb | |
| data = 'YUVoYVMwSnVkVkJxU2pGa1RHOTRlbGR3U25WVUt6ZDNSRE5MZVhKd1YyVnZTbFUyUVhSdWRUUk5MM05ZYkVobVJVRlBVWHBKVjBaQlNHRkRhVFZzYlVsWlJHdERZV1pqYTA5d1pETTVjSEZyY21RNE5HNVBSMEpLTmpsVU1uSnZUMVkzV1RrelJraHlPSGxHVDBJNFJGWjRSVTgyWlZkamJHUlplV0V6T0hRdExWUlZSMUF2T1hoNU1HUjJkRE5qV21welVraEdOVkU5UFE9PS0tNTA1YjMzMjliYmU3NjVmMDVlN2E4MmU3MjM3ODE4ODVlZjJlNzNlYw==' | |
| data = Base64.strict_decode64(data) | |
| encryptor = ActiveSupport::MessageEncryptor.new(CLIENT_SECRET) | |
| encryptor.decrypt_and_verify(data) |
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
| server { | |
| listen 80; | |
| server_name mysite.com; | |
| root /var/www/mysite.com/; | |
| location / { | |
| if (-f $document_root/maintenance.html) { | |
| return 503; | |
| } | |
| ... # the rest of your config goes here |
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 remove_records(existing_records, records, method) | |
| records.each { |record| callback(:before_remove, record) } | |
| records.each { |record| callback(:before_destroy, record) } | |
| delete_records(existing_records, method) if existing_records.any? | |
| records.each { |record| target.delete(record) } | |
| records.each { |record| callback(:after_destroy, record) } | |
| records.each { |record| callback(:after_remove, record) } | |
| 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
| def remove_records(existing_records, records, method) | |
| records.each { |record| callback(:before_remove, record) } | |
| delete_records(existing_records, method) if existing_records.any? | |
| records.each { |record| target.delete(record) } | |
| records.each { |record| callback(:after_remove, record) } | |
| 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 User | |
| include ModelUtils | |
| def some_method | |
| unique_id_for(self) | |
| end | |
| end | |
| module ModelUtils | |
| module_function |
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
| var exp = /-([a-z])/gi; | |
| s = 'background-color'; | |
| s.replace(exp, function(m, c, i, str) { | |
| return c.toUpperCase(); | |
| } | |
| ); |
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
| query = GraphEngine::UserPlace.where(place_id: place_id).or( | |
| {:user_id.in => user.gogobot_following_ids, :ext_app_type => GraphEngine::ExtAppType::GOGOBOT}, | |
| {:user_id.in => user.facebook_friend_ids, :ext_app_type => GraphEngine::ExtAppType::FACEBOOK} | |
| ).asc(:ext_app_type) |
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
| # ~/.tmuxinator/graph_engine.yml | |
| # you can make as many tabs as you wish... | |
| project_name: graph_engin | |
| project_root: ~/dropbox/projects/graph_engine | |
| rvm: ruby-1.9.3-p0@graph_engine | |
| tabs: | |
| - editor: | |
| layout: main-horizontal | |
| panes: |
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 cookies | |
| @arrival_date = cookies['check_in_date'].to_s | |
| @departure_date = cookies['check_out_date'].to_s | |
| end | |
| @number_of_nights = (@departure_date.to_date - @arrival_date.to_date).to_i |