Skip to content

Instantly share code, notes, and snippets.

View itsNikolay's full-sized avatar
📈
Better then yesterday

Nikolay Ponomarev itsNikolay

📈
Better then yesterday
View GitHub Profile
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem 'rails', '5.2.4.5'
gem 'sqlite3'
end
#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)
$> 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
#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)
# for more info: https://gist.github.com/1120938
=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')
#!/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", {}
@itsNikolay
itsNikolay / application.css
Created March 11, 2013 10:51
application.css
/*
*= require_self
*= require_tree .
*/
@import "bootstrap";
html, body {
height: 100%;
}
* 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
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