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
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
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
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'