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
| python -m SimpleHTTPServer |
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
| @consumer=OAuth::Consumer.new( oauth_app_token, | |
| oauth_app_secret, | |
| {:site => 'http://www.tumblr.com'}) | |
| @request_token=@consumer.get_request_token | |
| @request_token.authorize_url | |
| @access_token = @request_token.get_access_token(:oauth_token => oauth_token, | |
| :oauth_verifier => oauth_verifier ) |
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 ActionController | |
| module RequestForgeryProtection | |
| def verify_authenticity_token | |
| verified_request? || handle_unverified_request | |
| end | |
| def handle_unverified_request | |
| reset_session | |
| 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 'logger' | |
| if ENV.include?('RAILS_ENV')&& | |
| !Object.const_defined?('RAILS_DEFAULT_LOGGER') | |
| Object.const_set('RAILS_DEFAULT_LOGGER', Logger.new(STDOUT)) | |
| else | |
| ActiveRecord::Base.logger = Logger.new(STDOUT) | |
| 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
| namespace :db do | |
| namespace :structure do | |
| desc "Dump the database structure to a SQL file" | |
| task :dump => :load_config do | |
| config = ActiveRecord::Base.configurations[Rails.env] | |
| command = "mysqldump -u #{config["username"]} #{config["database"]} --no-data --skip-comments --skip-add-drop-table > db/#{Rails.env}_structure.sql" | |
| puts "Running: #{command}" | |
| system command |
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
| # | |
| # Add a :processing flag to our model | |
| # | |
| class AddProcessingToImages < ActiveRecord::Migration | |
| def self.up | |
| add_column :images, :processing, :boolean | |
| end | |
| def self.down |
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
| mysqldump -h DB_HOST -u DB_USER -p DB_PASSWORD --opt --quote-names \ | |
| --skip-set-charset --default-character-set=latin1 DB_NAME > DB_NAME-dump.sql | |
| mysql -h DB_HOST -u DB_USER -p DB_PASSWORD \ | |
| --default-character-set=utf8 DB_NAME < DB_NAME-dump.sql | |
| via http://blog.hno3.org/2010/04/22/fixing-double-encoded-utf-8-data-in-mysql/ |
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
| select concat('alter table `', table_name ,'` add constraint `', constraint_name, '` foreign key (`', column_name ,'`) references `', referenced_table_name , '` (`',referenced_column_name,'`)') from information_schema.key_column_usage where table_schema = 'siic_v2' and constraint_name not like 'PRIMARY%'; |
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
| [mysql] | |
| prompt=(\\u@\\h) [\\d]>\\_ |
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
| # to be able to keep a different version than in repo and not commiting it | |
| git update-index --assume-unchanged filename |
OlderNewer