Skip to content

Instantly share code, notes, and snippets.

View vsalbaba's full-sized avatar

Vojtech Salbaba vsalbaba

  • Red Hat
  • Czech Republic
View GitHub Profile
# Mouse color:string archive_number:string archived_at:datetime
class Mouse < ActiveRecord::Base
acts_as_archival
attr_accessible :color
end
<h1>New ftp user</h1>
<form action="/web_hostings/2/ftp_users" class="formtastic ftp_user" id="new_ftp_user" method="post">
<div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="O0A3Y7hx1rK0+W6NQqiNu0ai3/2QXaqrX+vKx8fU4rc=" />
</div>
<fieldset class="inputs">
<ol> <li class="string optional" id="ftp_user_sub_username_input"><label for="ftp_user_sub_username">Jméno</label><input id="ftp_user_sub_username" name="ftp_user[sub_username]" size="50" type="text" /></li>
<li class="password required" id="ftp_user_password_input"><label for="ftp_user_password">Heslo<abbr title="required">*</abbr></label><input id="ftp_user_password" name="ftp_user[password]" size="50" type="password" /></li>
<li class="string optional" id="ftp_user_sub_dir_input"><label for="ftp_user_sub_dir">Adresář na serveru</label><input id="ftp_user_sub_dir" name="ftp_user[sub_dir]" size="50" type="text" /></li>
<% title 'Zaregistrovat nový účet'%>
<% semantic_form_for @account, :url => {:controller => :orders, :action => :new_account} do |f|%>
<% f.inputs do %>
<%= f.input :subdomain %>
<%= f.input :name %>
<%= f.input :street %>
<%= f.input :city %>
<%= f.input :psc %>
<%= f.input :phone %>
<%= f.input :ico %>
## pomoci stringu
result = ""
if condition then
result << "neco neco #{kus ruby kodu pro vlozeni do stringu} neco neco"
end
zapis_to_do_souboru
## pomoci eruby
context = ERB.context.new
def self.up
create_table :ftp_users do |t|
t.string :username
t.string :password
t.string :uid
t.string :gid
t.string :dir
t.integer :web_hosting_id
t.integer :state
t.timestamps
def self.pkg(platform, opt)
extension = case platform
when "win32" then
"exe"
when "linux" then
"run"
when "osx" then
"dmg"
else
raise "Unknown platform"
def self.pkg(platform, opt)
# first try internet
# On the url there should be link to latest revision of our release.
# so programs writen for raisins will use latest revision of raisins and will not break with possible changes in future releases.
# I presume http://shoes.heroku.com/
url =
case opt
when I_YES; "http://rock.nalinuxu.cz/~darktatka/pkg/#{RELEASE_NAME.downcase}/#{platform}/shoes"
when I_NOV; "http://shoes.heroku.com/pkg/#{RELEASE_NAME.downcase}/#{platform}/shoes-novideo"
public Tah Najdi_nejlepsi_tah()
{
Random rand = new Random ();
int i = 0;
for (i = 0; i < strom.Count; i++)
{
if (strom[i].Ohodnoceni == 5000)
def self.pkg(platform, opt)
# short time solution <start>
extension = case platform
when "win32" then
"exe"
when "linux" then
"run"
when "osx" then
"dmg"
else
extension = case platform
when "win32" then
"exe"
when "linux" then
"run"
when "osx" then
"dmg"
else
raise "omg, unknown platform!"
end