Skip to content

Instantly share code, notes, and snippets.

View bosskovic's full-sized avatar

Marko Bošković bosskovic

  • Jomb AG
  • Novi Sad, Serbia
View GitHub Profile
@bosskovic
bosskovic / common_commands.sh
Created November 24, 2014 19:56
nginx notes
sudo service nginx start
sudo service nginx stop
sudo service nginx restart
# show configuration errors
nginx -c /etc/nginx/nginx.conf -t
# Initialize repository:
git init
# Get current status:
git status
# Add file myfile.txt:
git add myfile.txt
# Commit with a message:
@bosskovic
bosskovic / Capfile
Last active August 29, 2015 14:10
capistrano setup
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails/migrations'
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
Dir.glob('lib/capistrano/**/*.rb').each { |r| import r }
=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')
@bosskovic
bosskovic / Gemfile
Last active November 30, 2018 19:19
Developing rails REST API with Cucumber
. . .
group :test do
gem 'cucumber-rails', '1.4.1', :require => false
gem 'json_spec', '1.1.2'
. . .
@bosskovic
bosskovic / adding_repositories.sh
Last active August 29, 2015 14:05
After installing Ubuntu 14.04
sudo add-apt-repository -y ppa:videolan/stable-daily
sudo add-apt-repository -y ppa:otto-kesselgulasch/gimp
sudo add-apt-repository -y ppa:gnome3-team/gnome3
sudo add-apt-repository -y ppa:webupd8team/java
sudo add-apt-repository -y ppa:webupd8team/y-ppa-manager
sudo add-apt-repository -y ppa:atareao/atareao
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
@bosskovic
bosskovic / Gemfile
Last active September 21, 2022 14:24
Devise as authentication solution for rails API
gem 'devise', '3.2.4'
gem 'simple_token_authentication', '1.5.0'
@bosskovic
bosskovic / api_constraints.rb
Created August 19, 2014 18:56
Rails API versioning
# lib/api_constraints.rb
class ApiConstraints
def initialize(options)
@version = options[:version]
@default = options[:default]
@domain = options[:domain]
end
def matches?(req)
# https://github.com/jayzes/cucumber-api-steps
# https://gist.github.com/gonzalo-bulnes/7069339
# http://anthonyeden.com/2013/07/10/testing-rest-apis-with-cucumber-and-rack.html
# http://vimeo.com/30586709
Given /^I send and accept HTML$/ do
header 'Accept', "text/html"
header 'Content-Type', "application/x-www-form-urlencoded"
end
# features/step_definitions/api_steps.rb
# These steps are very deeply inspired in the Anthony Eden (@aeden) API steps.
# See http://vimeo.com/30586709
# Given
Given /^I send and accept JSON$/ do
header 'Accept', 'application/json'