Characteristics of a lean startup:
-
Uses "platforms enabled by open source and free software."
-
Agile development
| namespace :db do | |
| namespace :data do | |
| desc "Load data into current environment" | |
| task :load => [:environment, 'db:drop', 'db:create'] do | |
| db = ActiveRecord::Base.configurations[RAILS_ENV] | |
| %x( mysql -u #{db['username']} --password=#{db['password']} #{db['database']} < "#{RAILS_ROOT}/db/dump/data.sql" ) | |
| end | |
| desc "Dump current database schema and data to file" | |
| task :dump => :environment do |
| # Adapted from http://gist.github.com/31934 | |
| # http://henrik.nyh.se/2008/12/git-dirty-prompt | |
| # http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
| RED="\[\033[0;31m\]" | |
| ORANGE="\[\033[0;33m\]" | |
| YELLOW="\[\033[0;33m\]" | |
| GREEN="\[\033[0;32m\]" | |
| BLUE="\[\033[0;34m\]" | |
| LIGHT_RED="\[\033[1;31m\]" | |
| LIGHT_GREEN="\[\033[1;32m\]" |
| # Grab a password out of the 1Password keychain...finding it by "name" | |
| def password_for_hostname(name) | |
| password_info = `security 2>&1 >/dev/null find-generic-password -gs passwords.Password:#{name} 1Password.keychain` | |
| password = password_info.match(/\"\:\"(.+)\"\}\"/)[1] rescue nil | |
| end |
| -- Separate your work email from your home email in Mail.app. | |
| -- | |
| -- Sure, you can use separate mailboxes or smart mailboxes to separate | |
| -- your mail, but sometimes you don’t even want to know that you have | |
| -- new “home” mail while you’re at work (or vice versa). Sometimes you | |
| -- want to work exclusively in one context, free from the distractions | |
| -- of the other context: you don’t want to hear that "new mail" chime | |
| -- for mail that belongs to other (non-active) contexts, and you don’t | |
| -- want to see the "unread" count for mail in other (non-active) | |
| -- contexts. Cue Jonathan Wise's "Mail Account Chooser" script. |
| after "deploy:restart", "deploy:tag_last_deploy" | |
| namespace :deploy do | |
| # see http://codeintensity.blogspot.com/2008/06/changelogs-and-deployment-notification.html | |
| task :tag_last_deploy do | |
| set :tag_name, "deployed_to_#{rails_env}_#{timestamp_string_without_seconds}" | |
| `git tag -a -m "Tagging deploy to #{rails_env} at #{timestamp_string_without_seconds}" #{tag_name} #{branch}` | |
| `git push --tags` | |
| puts "Tagged release with #{tag_name}." | |
| end |
| # Put this in your .irbrc, and then type | |
| # "some_object.my_methods" in an IRB session | |
| # for less noisy exploration of what objects | |
| # can do. | |
| class Object | |
| def my_methods | |
| base_object = case self | |
| when Class then Class.new | |
| when Module then Module.new |
| #vim: ruby | |
| # | |
| # This script will import all your Mephisto comments into Disqus (http:/disqus.com) | |
| # parts of it came from http://www.locomotivation.com/blog/2008/12/01/disqus-sinatra-importer.html | |
| # but instead of a blog-engine independent sinatra app we needed a mephisto-specific script that | |
| # will just do the job :) | |
| unless defined?(RAILS_ROOT) | |
| puts "This is a Rails 'runner' script. Please run './script/runner path/to/disqus_import' inside your Mephisto directory" | |
| exit |
Characteristics of a lean startup:
Uses "platforms enabled by open source and free software."
Agile development
| # git | |
| alias gl='git pull' | |
| alias gp='git push' | |
| alias gd='git diff | mate' | |
| alias gdh='git diff HEAD | mate' | |
| alias gc='git commit -v' | |
| alias gca='git commit -v -a' | |
| alias gcap='git commit -v -a && git push' | |
| alias gb='git branch' | |
| alias gba='git branch -a' |
| # generate a fresh app | |
| rails -v | |
| rails new whizbang | |
| cd whizbang | |
| # show empty log file | |
| cat log/production.log | |
| # script/runner successfully writes to the log file | |
| ./script/rails runner 'Rails.logger.error("Hello from script/runner")' -e production |