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 add_line_item_to_cart | |
#Get current_cart object | |
current_cart | |
quantity = params[:quantity].to_i | |
id = params[:id].to_i | |
line_item = LineItem.find(:first, :conditions => {:cartridge_id => id, :cart_id => current_cart.id}) | |
if line_item | |
line_item.cart_id = current_cart.id |
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
$('document').ready(function() { | |
// Don't work | |
$( "#message_number_false" ).click( | |
function() { | |
$( "#call_back_text" ).show(100); | |
}); | |
// Don't work | |
$( "#message_number_true" ).click( | |
function() { |
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 MyModel < ActiveRecord::Base | |
after_initialize :setup_defaults | |
attr_accessor :foo_bar | |
def setup_defaults | |
@foo_bar ||= "my default value" | |
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
/* | |
* This is a manifest file that'll automatically include all the stylesheets available in this directory | |
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at | |
* the top of the compiled file, but it's generally better to create a new file per style scope. | |
*= require_self | |
*= require_tree . | |
*= require layout | |
*/ |
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
development: | |
adapter: postgresql | |
database: emotio-dev | |
pool: 5 | |
timeout: 5000 | |
# Warning: The database defined as "test" will be erased and | |
# re-generated from your development database when you run "rake". | |
# Do not set this db to the same as development or production. | |
test: |
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
//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 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 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
assets = require 'connect-assets' | |
eco = require 'eco' | |
assets.jsCompilers.eco = | |
eco: | |
match: /\.eco$/ | |
compileSync: (sourcePath, source) -> | |
eco.compile source |
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
#!/usr/bin/env ruby | |
# 1283314500 EXPORTS NET-A-PORTER LIVE DATA INTO POSTGRESQL | |
require "logger" | |
require "sequel" | |
#require "pgpass" | |
require "fileutils" | |
module NAP |
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
if ! $(psql template1 -c 'SHOW SERVER_ENCODING' | grep -q UTF8); then | |
psql postgres -c "update pg_database set datallowconn = TRUE where datname = 'template0';" | |
psql template0 -c "update pg_database set datistemplate = FALSE where datname = 'template1';" | |
psql template0 -c "drop database template1;" | |
psql template0 -c "create database template1 with template = template0 encoding = 'UTF8';" | |
psql template0 -c "update pg_database set datistemplate = TRUE where datname = 'template1';" | |
psql template1 -c "update pg_database set datallowconn = FALSE where datname = 'template0';" | |
fi |
OlderNewer