Skip to content

Instantly share code, notes, and snippets.

View sebastjan-hribar's full-sized avatar

Sebastjan Hribar sebastjan-hribar

View GitHub Profile
@sebastjan-hribar
sebastjan-hribar / gist:5720554
Created June 6, 2013 10:12
remove completed projects from xml file
require 'nokogiri'
def remove_completed(f)
file = File.open(f, "r")
doc = Nokogiri::XML(file)
completed_projects = []
doc.xpath("//ProjectListItem").each do |item|
info = item.xpath("./ProjectInfo").first
require 'bcrypt'
class Parent
include Hanami::Entity
attributes :name, :surname, :email, :password,
:password_confirmation, :password_reset_token, :password_reset_sent_at
attr_reader :password_hash, :password_salt
source 'https://rubygems.org'
gem 'bundler'
gem 'rake'
gem 'hanami', '0.7.0'
gem 'hanami-model', '~> 0.5'
gem 'thin'
gem 'sqlite3'
gem 'launchy'
gem 'bcrypt'
module Web::Controllers::Parents
class Create
include Web::Action
expose :parent
params do
param :parent do
param :name, presence: true
param :surname, presence: true
/home/sebastjan/.rvm/gems/ruby-2.2.1/gems/hanami-utils-0.7.1/lib/hanami/utils/class_attribute.rb:67: warning: `*' interpreted as argument prefix
/home/sebastjan/.rvm/gems/ruby-2.2.1/gems/url_mount-0.2.1/lib/url_mount.rb:55: warning: method redefined; discarding old variables
/home/sebastjan/.rvm/gems/ruby-2.2.1/gems/url_mount-0.2.1/lib/url_mount.rb:27: warning: previous definition of variables was here
/home/sebastjan/.rvm/gems/ruby-2.2.1/gems/http_router-0.11.2/lib/http_router/route.rb:10: warning: method redefined; discarding old match_partially
/home/sebastjan/.rvm/gems/ruby-2.2.1/gems/http_router-0.11.2/lib/http_router/route.rb:10: warning: method redefined; discarding old router
/home/sebastjan/.rvm/gems/ruby-2.2.1/gems/http_router-0.11.2/lib/http_router/generator.rb:58: warning: assigned but unused variable - generator
/home/sebastjan/.rvm/gems/ruby-2.2.1/gems/http_router-0.11.2/lib/http_router/route_helper.rb:99: warning: assigned but unused variable - params
/home/sebastjan/.rvm/gems/ruby-2.2.1/gems/h
@sebastjan-hribar
sebastjan-hribar / action.rb
Created April 20, 2016 18:34
params validation
module Web::Controllers::Posts
class Update
include Web::Action
before :check_for_admin_role
params do
param :post do
param :title, presence: true
param :body, presence: true
@sebastjan-hribar
sebastjan-hribar / create.rb
Created May 9, 2016 19:00
foreign_key issues with tests
module Web::Controllers::Conferences
class Create
include Web::Action
before :check_for_admin_role
expose :conference
params do
@sebastjan-hribar
sebastjan-hribar / rake_error.rb
Created June 9, 2016 05:59
helpers rake test error
(eval):2: warning: method redefined; discarding old link
(eval):2: warning: previous definition of link was here
/home/sebastjan/.rvm/gems/ruby-2.2.1/bundler/gems/view-6a51e5cd3daf/lib/hanami/presenter.rb:1: warning: loading in progress, circular require considered harmful - /home/sebastjan/.rvm/gems/ruby-2.2.1/bundler/gems/view-6a51e5cd3daf/lib/hanami/view/escape.rb
from /home/sebastjan/.rvm/gems/ruby-2.2.1/gems/rake-11.1.2/lib/rake/rake_test_loader.rb:4:in `<main>'
from /home/sebastjan/.rvm/gems/ruby-2.2.1/gems/rake-11.1.2/lib/rake/rake_test_loader.rb:4:in `select'
from /home/sebastjan/.rvm/gems/ruby-2.2.1/gems/rake-11.1.2/lib/rake/rake_test_loader.rb:9:in `block in <main>'
from /home/sebastjan/.rvm/gems/ruby-2.2.1/gems/rake-11.1.2/lib/rake/rake_test_loader.rb:9:in `each'
from /home/sebastjan/.rvm/gems/ruby-2.2.1/gems/rake-11.1.2/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
from /home/sebastjan/.rvm/gems/ruby-2.2.1/gems/rake-11.1.2/lib/rake/rake_test_loader.rb:10:in `require'
require 'green_shoes'
def set_no_days
@no_of_days = case @month
when 4 then 1..30
when 6 then 1..30
when 9 then 1..30
when 11 then 1..30
when 2 then 1..28
else 1..31
require 'green_shoes'
module DatePicker
def set_no_days
@no_of_days = case @month
when 4 then 1..30
when 6 then 1..30
when 9 then 1..30
when 11 then 1..30