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
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
gem 'rails', '5.2.4.5' | |
gem 'sqlite3' | |
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
#include <stdio.h> | |
#include <stdlib.h> | |
int *initArray(int n) { | |
int i; | |
int *array; | |
array = malloc(n * sizeof(*array)); | |
/* you should always check malloc success */ | |
if (array == NULL) |
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
$> rake g migraiton add_institution_id_to_users institution_id:integer | |
$> rake g migration add_user_id_to_loans user_id:integer | |
$> rake g migration add_loan_id_to_quotes loan_id:integer | |
$> rake g migration add_institution_id_to_type_of_loans institution_id:integer | |
models/institutions.rb | |
class Institution < ActiveRecord::Base | |
has_many :users | |
has_many :type_of_loans | |
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
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
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
# for more info: https://gist.github.com/1120938 |
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
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
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
#!/usr/bin/env ruby | |
#^syntax detection | |
site 'http://community.opscode.com/api/v1' | |
cookbook "apt" | |
cookbook "build-essential", {} | |
cookbook "rvm", {:github=>"fnichol/chef-rvm", :ref=>"v0.9.0"} | |
cookbook "git", {} | |
cookbook "postgresql", {} |
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_self | |
*= require_tree . | |
*/ | |
@import "bootstrap"; | |
html, body { | |
height: 100%; | |
} |
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
* 2013-03-10 23:26:23 executing `deploy' | |
* 2013-03-10 23:26:23 executing `deploy:update' | |
** transaction: start | |
* 2013-03-10 23:26:23 executing `deploy:update_code' | |
updating the cached checkout on all servers | |
executing locally: "git ls-remote ssh://user@198.211.125.210:2912/home/user/repos/wood-awesome.git master" | |
command finished in 1041ms | |
* executing "if [ -d /home/user/projects/wood-awesome/shared/cached-copy ]; then cd /home/user/projects/wood-awesome/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 74acf135a2f939174bf1a791e12390672d59761b && git clean -q -d -x -f; else git clone -q ssh://user@198.211.125.210:2912/home/user/repos/wood-awesome.git /home/user/projects/wood-awesome/shared/cached-copy && cd /home/user/projects/wood-awesome/shared/cached-copy && git checkout -q -b deploy 74acf135a2f939174bf1a791e12390672d59761b; fi" | |
servers: ["198.211.125.210"] | |
[198.211.125.210] executing command |
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
source 'https://rubygems.org' | |
gem 'rails', '3.2.12' | |
gem "pg" | |
gem 'jquery-rails' | |
gem 'therubyracer' | |
gem 'haml-rails' | |
gem 'bootstrap-sass', '~> 2.3.0.0' | |
group :assets do |
NewerOlder