Skip to content

Instantly share code, notes, and snippets.

View sebastjan-hribar's full-sized avatar

Sebastjan Hribar sebastjan-hribar

View GitHub Profile
rvm info:
ruby-2.1.1:
system:
uname: "Linux seba 3.11-2-amd64 #1 SMP Debian 3.11.8-1 (2013-11-13) x86_64 GNU/Linux"
system: "mint/1/x86_64"
bash: "/bin/bash => GNU bash, version 4.2.45(1)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"
require 'camping'
require 'etc'
Camping.goes :Review
module Review::Models
class Reviewform < Base
end
require 'camping'
Camping.goes :Test
module Test::Models
class Post < Base
end
class BasicFields < V 1.0
Camping.goes :Ajax
module Ajax::Controllers
class Index < R '/'
def get
render :index
end
end
class Add < R '/add'
def get
# 4. Zip the files again
def zip_dir
directory = "test/"
zipfile_name = "test2.zip"
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
Dir[File.join(directory, '**', '*')].each do |file|
zipfile.add(file.sub(directory, ''), file)
end
end
end
@sebastjan-hribar
sebastjan-hribar / camping_auth
Created March 14, 2015 20:53
camping - authentication
#Migration
class UserFields < V 1.1
def self.up
create_table User.table_name do |t|
t.string :username
t.string :email
t.string :role
t.string :password_hash
t.string :assword_salt
@sebastjan-hribar
sebastjan-hribar / apps.rb
Last active August 29, 2015 14:22
mount_more_apps
require 'pm'
require 'qm'
require 'camping'
Camping.goes :People
module People::Controllers
class Index < R '/'
def get
render :index
end
end
@sebastjan-hribar
sebastjan-hribar / add_project_spec.rb
Last active September 8, 2015 20:53
lotus template
require 'features_helper'
describe 'Projects' do
after do
ProjectRepository.clear
end
it 'can create a new project' do
visit '/projects/new'
save_and_open_page
1) Failure:
Web::Controllers::Projects::Show#test_0001_exposes a project [C:/Users/sebastjan/Documents/projekti/lotus/myProject/spec/web/controllers/projects/show_spec.rb:19]:
Expected: {:project=>#<Project:0x5de5668 @name="Test povezave1", @number="123",
@customer="Customer 1", @creation_date="23. 02. 2015", @purchase_order="sl-123",
@deadline="01. 04. 2015", @id=435>}
Actual: {:params=>#<Web::Controllers::Projects::Show::Params:0x5de53f8
@env={:id=>435, "lotus.action"=>#<Web::Controllers::Projects::Show:0x5de54d0 @_env={...},
@headers={"X-Frame-Options"=>"DENY", "Content-Security-Policy"=>"default-src 'none'; script-src 'self';