Skip to content

Instantly share code, notes, and snippets.

View kubicek's full-sized avatar

Jiří Kubíček kubicek

View GitHub Profile
function(doc) {
if (doc.content) {
var html = new XML(doc.content);
emit(doc._id, {title: doc.content});
}
emit("nic", "nikde")
}
function(doc) {
if (doc.content) {
var content = doc.content.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, ""); // bug 336551
var data = new XML(content);
var dtt = new Namespace("http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_datatypes/v_1.0.2");
emit(doc._id, {
name: data..dtt::Obchodni_firma.text(),
ic: data..dtt::ICO.text(),
konkurz: data..dtt::Konkurz.dtt::Kod.text()
});
get '/companies/:ic' do
@db = CouchRest.database!("http://127.0.0.1:5984/obchodni_rejstrik")
doc = @db.get(params[:ic])
xml = Nokogiri::XML(doc['content'])
xslt = Nokogiri::XSLT(File.read('obchodni_rejstrik.xslt'))
xslt.transform(xml).to_s
end
function(doc, req) {
if(doc) {
return { \"headers\" : {\"Content-Type\" : \"application/xml\"}, \"body\" : doc.content }
} else {
return {\"code\": 404, \"body\": \"Not-found\"}
}
}
pkg_add -r gmake erlang-lite libtool icu spidermonkey curl
cd /usr/ports/databases
fetch "http://www.freebsd.org/cgi/query-pr.cgi?prp=148803-1-txt&n=/patch.txt"
patch -p0 < patch.txt
rm patch.txt
cd /usr/ports/databases/couchdb
make install
We couldn’t find that file to show.
class CreateAccounts < ActiveRecord::Migration
def self.up
create_table(:accounts) do |t|
t.string :name
t.string :surname
t.string :email
t.string :crypted_password
t.string :salt
t.string :role
t.timestamps
@kubicek
kubicek / .gitignore
Created November 28, 2010 01:54 — forked from karmi/.gitignore
.DS_Store
*.log
tmp/
@kubicek
kubicek / gist:935066
Created April 21, 2011 17:36
Podpora Bundleru v Capistrano
after "deploy:update_code", "bundler:bundle_new_release"
namespace :bundler do
task :create_symlink, :roles => :app do
set :bundle_dir, File.join(release_path, 'vendor/bundle')
shared_dir = File.join(shared_path, 'bundle')
run "if [ -d #{bundle_dir} ]; then rm -rf #{bundle_dir}; fi" # in the event it already exists..?
run("mkdir -p #{shared_dir} && ln -s #{shared_dir} #{bundle_dir}")
end
module ApplicationHelper
def number_to_currency(number, options = {})
options[:unit]=t(:czk)
options[:format]="%n %u"
super(number, options)
end
end