Skip to content

Instantly share code, notes, and snippets.

@edshadi
edshadi / db_backup_script
Created February 10, 2012 18:38
mongo and mysql backup to s3 script
#!/usr/bin/env ruby
ENV["RAILS_ENV"] ||= "development"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 's3_file_methods'
require "fileutils"
def run(command)
result = system(command)
raise("error, process exited with status #{$?.exitstatus}") unless result

Definitions

General Testing

  • TDD Test Driven Development. Write examples before implementation.
  • BDD Behaviour-Driven Development is about implementing an application by describing its behavior from the perspective of its stakeholders. (The Rspec Book)
  • RSpec (mention alternatives, write a simple hand sewn test)

Testing Terms

[
{ "keys": ["shift+tab"], "command": "auto_complete" },
{ "keys": ["super+alt+]"], "command": "align_assignments" },
{ "keys": ["ctrl+shift+j]"], "command": "join_lines" },
{ "keys": ["super+alt+w"], "command": "toggle_setting", "args": {"setting": "word_wrap"} },
{ "keys": ["ctrl+super+r"], "command": "reveal_in_side_bar" },
{ "keys": ["ctrl+shift+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+t"], "command": "goto_recent" },
{ "keys": ["super+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} },
{ "keys": ["super+ctrl+w"], "command": "close_all" },

A typical module looks like this:

module M
  def self.included(base)
    base.extend ClassMethods
    scope :disabled, where(:disabled => true)
  end

  module ClassMethods
 ...
all programs / programming languages / software 3 kinds of artifacts and 1 quality
- data
x = 123
y = "hello"
z = true
my_name = gets.chomp
- decisions
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
var mockAjax = function() {
beforeEach(function() {
jasmine.Ajax.install();
})
afterEach(function() {
jasmine.Ajax.uninstall();
})
}
var lastRequest = function() {
return jasmine.Ajax.requests.mostRecent();
desc "Renaming Rails App"
task :rename, [:message] => :environment do |t, args|
file_names = %w{config/application.rb
config/environment.rb
config.ru
Rakefile
config/routes.rb
config/environments/development.rb
config/environments/production.rb
config/environments/test.rb
- report: sales_by_traffic_referrer
questions:
- Which referrer source created the most sales in 2024?
- What was the Sales generated by referrer source email in 2023?
- report: average_order_value
questions:
- Which month and day had the highest order value?
- Which month and day had the lowest order value?
- How did the average order value change over 2023?
- What is the growth of average order value between 2023 and 2024?