Skip to content

Instantly share code, notes, and snippets.

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

@Carpk
Carpk / RSpec.md
Last active February 21, 2016 06:21
rspec cheatsheet

CHEAT SHEETS

$ command line ruby cheat sheets

INSTALL

$ gem install rspec

Web App Performance

Back End

N+1

  @users = User.all.includes(:profile) # SELECT * from users

Excessive joins/subselects or exta queries

@Carpk
Carpk / sudoku.rb
Last active August 29, 2015 13:57
Sudoku solver
require 'benchmark'
class Sudoku
def initialize(board_string)
@board = create_board(board_string.split(//).map {|str| str.to_i})
@potentials = (0..9).to_a
end
def create_board(num_array)

Design Process

  1. Define the problem.
  2. Wireframe.
  3. Prototype.
  4. Test, gather feedback, refine.

Define the problem

  • Talk to people (users, clients, customers, businesspeople).

Managing Secret Data in Open source Applications

If you're working on an open source project, committing API keys or secrets to your repo is a big no-no. You wouldn't want anyone else making request with your keys, right?

So instead of putting those keys in app/config/initializers set then as environment variables in your shell. Here's an example for a Facebook API key:

export FB_API_KEY=3629346238763284623874623
// TicTacToe.cpp
// for CS 141 lab 4
// Password: Brown
//
#include <iostream>
using namespace std;
//----------------------------------------------------------------------------------
// Display the board.