This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post < ActiveRecord::Base | |
class << self | |
alias_method :find_standard, :find | |
end | |
validates_presence_of :publish_from, :publish_to | |
before_create :validates_time | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post < ActiveRecord::Base | |
cattr_accessor :state_from, :state_to | |
include ActiveSupport::Callbacks | |
define_callbacks :after_transition | |
#kod .... | |
#(...) | |
aasm_event :view, :enter => :enter, :exit => :exit, :success => :success do | |
transitions :to => :read, :from => [:unread] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'uri' | |
require 'rexml/document' | |
class GG | |
attr_accessor :token, :server, :port, :uin, :login, :pass, :content_type | |
def initialize(options={}) | |
self.uin=options[:uin] unless options[:uin].nil? | |
self.pass= options[:pass] unless options[:pass].nil? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CommentObserver < ActiveRecord::Observer | |
def after_create(comment) | |
GADU.message :to=> 3062261, :text => "Artykuł #{comment.post.title} otrzymał nowy komentarz\r\n#{comment.id} od #{comment.author}\r\nczytaj na: http://blog.baael.pl/#{comment.post.permalink}" | |
#for PULL | |
# "\r\nzaakceptować? [t/n] (||akceptuj:id)" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module I18n | |
module Backend | |
class PolishPluralization < Simple | |
def pluralize(locale, entry, count) | |
return entry unless entry.is_a?(Hash) and count | |
case locale | |
when 'pl' | |
key = :zero if count == 0 && entry.has_key?(:zero) | |
key = :one if count==1 && count%100!=11 | |
key ||=((2..4).include?(count%10) && !(12..14).include?(count%100))? :few : :other |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Formula pluralizations for I18n | |
# by Wojciech Zieliński ([email protected], http://github.com/baael) | |
pl: | |
formula: | |
one: "{{count}}==1 && {{count}}%100!=11" | |
few: "(2..4).include?({{count}}%10) && !(12..14).include?({{count}}%100)" | |
default: "other" | |
test: | |
gry: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# teraz uzyjemy form_for bo mamy obiekt | |
<div><%= error_messages_for 'news' %></div> | |
<% form_for(@news, :url => {:controller =>'news', :action =>'create'}) do |f| %> | |
Temat:<%= f.text_field :subject %><br /> | |
Skrót:<%= f.text_field :body_short %><br /> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def can_edit? site | |
value=permissions.find(:first, | |
:conditions => ["`permissions`.content_id = ? and `permissions`.content_type = ?",site.id, site.class.to_s ], | |
:order => 'FIND_IN_SET(`owner_type`, "user,section"), `permissions`.rank DESC' | |
) || ((section)? section.permissions.find(:first, | |
:conditions => ["`permissions`.content_id = ? and `permissions`.content_type = ?",site.id, site.class.to_s ], | |
:order => 'FIND_IN_SET(`owner_type`, "user,section"), `permissions`.rank DESC' | |
) : nil ) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// install.sgz package should be in this directory | |
include("backup.php"); | |
set_time_limit(0); | |
if(!is_writable("backup.php")){ | |
echo "Plik backup.php nie ma uprawnień do zapisu!"; | |
exit; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title><%= yield :title %></title> | |
<script type="text/javascript" src="/jquery-1.3.2.js"></script> |
OlderNewer