Skip to content

Instantly share code, notes, and snippets.

@oki
oki / czas.rb
Created December 2, 2009 11:58
#!/usr/local/bin/ruby
# $ ruby czas.rb
# Czas pracy (domyslnie 8h):
# Na ktora przyszedles do pracy (ex: 8:00):8:25
# Wolny za: 3 hours, 1 minute and 9 seconds
# gem install rails --no-ri --no-rdoc
# install gem from http://github.com/yipdw/after_commit
# config/environment.rb:
config.gem 'after_commit', :version => '1.0.5', :source => 'http://gemcutter.org'
# Model User:
class User < ActiveRecord::Base
<% semantic_form_for @current_user, :url => save_settings_path do |form| %>
<% form.inputs :name => "Allegro", :for => :allegro_account do |allegro| -%>
<%= allegro.input :login, :hint => "Login z allegro" -%>
<%= allegro.input :password, :hint => "Haslo z allegro" -%>
<% end %>
<% end %>
@oki
oki / example
Created December 15, 2009 01:00
state_machine> t = TrafficLight.new
state_machine> t.change_color; t.state_name
=> :red_yellow
state_machine> t.change_color; t.state_name
=> :green
state_machine> t.change_color; t.state_name
=> :yellow
state_machine> t.change_color; t.state_name
=> :red
state_machine> t.change_color; t.state_name
set the ClipURL to (the clipboard as string)
ignoring case
if ((characters 1 through 4 of ClipURL as string) is not "http") then
return "Malformed URL."
else
set curlCMD to ¬
"curl --stderr /dev/null \"http://tinyurl.com/api-create.php?url=" & ClipURL & "\""
-- Run the script and get the result:
begin
#raise
#raise Timeout::Error.new('fuckme')
raise ScriptError
rescue Exception => e
if [Timeout::Error,RuntimeError,ScriptError].include? e.class
puts "OK"
else
raise
end
require 'socksify'
TCPSocket::socks_server = "127.0.0.1"
TCPSocket::socks_port = 6969
Adding reference: ant.PropertyHelper
Detected Java version: 1.5 in: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
Detected OS: Mac OS X
Adding reference: ant.ComponentHelper
Trying to override old definition of task java
+Datatype java org.apache.tools.ant.module.bridge.impl.ForkedJavaOverride
parsing buildfile jar:file:/Applications/NetBeans/NetBeans%206.8.app/Contents/Resources/NetBeans/java3/ant/nblib/org-netbeans-modules-debugger-jpda-ant.jar!/org/netbeans/modules/debugger/jpda/ant/antlib.xml with URI = jar:file:/Applications/NetBeans/NetBeans%206.8.app/Contents/Resources/NetBeans/java3/ant/nblib/org-netbeans-modules-debugger-jpda-ant.jar!/org/netbeans/modules/debugger/jpda/ant/antlib.xml
Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found.
+Datatype nbjpdaconnect org.netbeans.modules.debugger.jpda.ant.JPDAConnect
+Datatype nbjpdastart org.netbeans.modules.debugger.jpda.ant.JPDAStart
<body id="nazwa_zakladki"> <!-- np: sessions, settings, accounts, auctions -->
<ul id="tabnav">
<% if logged_in? %>
<li class="sessions"><%= link_to 'Index', root_path %></li>
<li class="items"><%= link_to "Licytacje", items_path -%></li>
<li class="auctions"><%= link_to "Aukcje", auctions_path -%></li>
<li class="accounts"><%= link_to "RapidShare", accounts_path -%></li>
<li class="settings"><%= link_to "Ustawienia", settings_path -%></li>
$("#materials_sortable li").hover(
function () {
$(this).find('.delete_material').toggle()
},
function () {
$(this).find('.delete_material').toggle()
}
);