This is a maintained listing of all the different ways to debug and profile Node.js applications. If there is something missing or an improvement, post a comment! :)
This file contains 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 desc "Backup project database. Options: DIR=backups RAILS_ENV=production MAX=7" | |
task :backup => [:environment] do | |
datestamp = Time.now.strftime("%Y-%m-%d_%H-%M-%S") | |
base_path = Rails.root | |
base_path = File.join(base_path, ENV["DIR"] || "backups") | |
backup_base = File.join(base_path, 'db_backups') | |
backup_folder = File.join(backup_base, datestamp) | |
backup_file = File.join(backup_folder, "#{RAILS_ENV}_dump.sql") | |
FileUtils.mkdir_p(backup_folder) | |
db_config = ActiveRecord::Base.configurations[RAILS_ENV] |
This file contains 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 login_as(user) | |
raise "Was expecting a User. Got a #{user.class} instead. Exiting." if user.class != User | |
@controller.request.env['warden'] = mock( | |
Warden, | |
:authenticate => user, | |
:authenticate! => user, | |
:authenticated? => true, | |
:authenticate? => true | |
) | |
user.last_sign_in_at = Time.now |
backup: mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql
restore: mysql -u root -p[root_password] [database_name] < dumpfilename.sql
mysqldump -u appzone -pP@rtnerpedia appzone_qa > 1.sql
2. backup/restore redis(http://code.google.com/p/redis-dump/)
This file contains 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
# Maintenance script needed to rename old S3 resources according to new URL encoding | |
desc "One-time renaming of all the amazon s3 content" | |
task :rename_s3_files do |t, args| | |
require 'aws/s3' | |
require Rails.root.join('app', 'helpers', 'paperclip_sanitization_helper.rb') | |
cred = YAML.load(File.open("#{Rails.root}/config/s3.yml"))[Rails.env].symbolize_keys! | |
attr_bucket = cred.delete(:bucket) | |
AWS::S3::Base.establish_connection! cred |
- Jim Weirich: The Building Blocks of Modularity – http://goo.gl/g4Nk
- Jim Weirich: SOLID Ruby – http://goo.gl/z3jd
- Sandi Metz: SOLID Object-Oriented Design – http://goo.gl/PDn6T
- Sandi Metz: Less – The Path to Better Design – http://goo.gl/VuTl4
- Demeter is for Encapsulation – http://is.gd/eeyLx
- Opinionated Modular Code – http://is.gd/eeyXm
- Scaling to Hundreds of Millions of Requests – http://vimeo.com/12814529
- Confident Code – http://goo.gl/VFLX
- Destroy All Software Screencasts – https://www.destroyallsoftware.com/screencasts
- Corey Haines: Fast Rails Tests – http://goo.gl/Va2gb
In order to demo your feature specs, follow these steps:
- Add capybara, poltergeist, launchy and selenium-webdriver to your Gemfile under test and development group.
- Add the attached demo helper to your spec/support.
- Add the capybara config to your spec_helper file.
- Run bundle install.
- Write your feature with its scenario specs.
- Put a demo filter on each scenario you want to demo. ( refer to the example below )
- Run bundle exec rspec spec.
This file contains 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 'spec/support/grep_matcher' | |
describe do | |
disallow_presence_of pattern: "send(.*#", | |
location: "app/", | |
description: "Do not use dynamic method invocations", | |
failure: "Please change dynamic method call to something more sane." | |
end |
This file contains 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
git checkout master && git branch | grep -v "master" | xargs git branch -D | |
find . -name \*.swo -type f -delete | |
find . -name \*.swp -type f -delete |
This file contains 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
2015-09-27T16:49:32.499Z 20607 TID-oxqcy0uyc Gnip::DownloadWorker JID-a5fe6232f54b78156e1068a4 INFO: done: 5.392 sec | |
2015-09-27T16:49:32.506Z 20607 TID-oxqdn2bn0 Gnip::DownloadWorker JID-6c6935f07def12d984bb7b82 INFO: start | |
2015-09-27T16:49:32.515Z 20607 TID-oxqcy0uyc Gnip::DownloadWorker JID-232e8e816a9b956bc7221669 INFO: start | |
2015-09-27T16:49:32.516Z 20607 TID-oxqdn67x0 Gnip::DownloadWorker JID-376da939d0e1b0c915b59a1c INFO: start | |
downloading /Users/igorb/work/verifeed-twitter/downloads/7q29mfvq74/2015/08/01/01_40_activities.json... | |
2015-09-27T16:49:33.225Z 20607 TID-oxqe01c8w Gnip::DownloadWorker JID-1686444e5f46ee87f5ca8db5 INFO: done: 6.133 sec | |
2015-09-27T16:49:33.232Z 20607 TID-oxqe01c8w Gnip::DownloadWorker JID-10cdf58624f007f44bbb48f3 INFO: start | |
downloading /Users/igorb/work/verifeed-twitter/downloads/7q29mfvq74/2015/08/01/01_50_activities.json... | |
2015-09-27T16:49:34.791Z 20607 TID-oxqe01myg Gnip::DownloadWorker JID-c2e53aacf2a8eee9efeac039 INFO: done: 7.645 sec | |
2015-09-27T16:49:34.805Z 20607 TID-ox |
OlderNewer