This file contains hidden or 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 create | |
@cart = current_cart | |
product = Product.find(params[:product_id]) | |
@line_item = @cart.add_product(product.id) | |
respond_to do |format| | |
if @line_item.save | |
format.html { redirect_to(store_url)} | |
format.js { @current_item = @line_item } | |
format.xml { render :xml => @line_item, :status => :created, :location => @line_item } |
This file contains hidden or 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
Titanium.UI.setBackgroundColor('#000') | |
tabGroup = Titanium.UI.createTabGroup() | |
win1 = Titanium.UI.createWindow | |
title:'Tab 1' | |
backgroundColor:'#fff' |
This file contains hidden or 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
//wyświetla wszystkie argumenty, w nawiasie podając ich długość | |
int dl_napisu(char n[]) { | |
int i = 0; | |
while(n[i] != 0) | |
i++; | |
return i; | |
} | |
This file contains hidden or 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
Assuming your username is "username" | |
$ sudo gpasswd -a postfres username | |
$ sudo postgres createuser username | |
This file contains hidden or 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 'mechanize' | |
require 'shellwords' | |
agent = Mechanize.new | |
agent.user_agent_alias = 'Windows IE 7' | |
page = agent.get('https://online.lloydstsb.co.uk/personal/logon/login.jsp') | |
login_form = page.forms.first | |
login_form.send("frmLogin:strCustomerLogin_userID", "1234") | |
login_form.send("frmLogin:strCustomerLogin_pwd", "secret") | |
page = agent.submit login_form |
This file contains hidden or 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
ome/dennis/.rvm/gems/ruby-1.9.2-p290/bin/rspec: [BUG] Segmentation fault | |
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux] | |
-- control frame ---------- | |
c:0001 p:0000 s:0002 b:0002 l:00124c d:00124c TOP | |
--------------------------- | |
-- C level backtrace information ------------------------------------------- | |
/home/dennis/.rvm/rubies/ruby-1.9.2-p290/lib/libruby.so.1.9(rb_vm_bugreport+0x72) [0xb77100e2] | |
/home/dennis/.rvm/rubies/ruby-1.9.2-p290/lib/libruby.so.1.9(+0x563a1) [0xb75ea3a1] |
This file contains hidden or 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 'Qt4' | |
include Qt | |
app = Application.new ARGV | |
w = MainWindow.new | |
Label.new('foobar',w) | |
w.show | |
app.exec |
This file contains hidden or 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 'Qt4' | |
include Qt | |
Application.new ARGV do | |
MainWindow.new do | |
Label.new 'foobar', self | |
show | |
end | |
exec | |
end |
This file contains hidden or 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 Command | |
class << self | |
%w[shutdown reboot open close].each do |method_name| | |
define_method method_name do | |
lambda do | |
puts method_name | |
Thread.new { $selected_client.client_rpc.send(method_name) } #this way does not work | |
Thread.new { eval("$selected_client.client_rpc.#{method_name}") } #this way does |
This file contains hidden or 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 Sum : public XmlRpcServerMethod | |
{ | |
public: | |
Sum(XmlRpcServer* s) : XmlRpcServerMethod("Sum", s) {} | |
void execute(XmlRpcValue& params, XmlRpcValue& result) | |
{ | |
int nArgs = params.size(); | |
double sum = 0.0; | |
for (int i=0; i<nArgs; ++i) |