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 'spec_helper' | |
describe CampaignsController do | |
let(:user){ create(:admin_user) } | |
before(:each) do | |
sign_in user | |
end | |
describe "GET #index" do |
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
<?php | |
mysql_connect("localhost", "mysql_user", "mysql_password") or die("Could not connect: " . mysql_error()); | |
mysql_select_db("mydb"); | |
$result = mysql_query("SELECT price, product_id FROM product_attributes"); | |
while ($row = mysql_fetch_array($result, MYSQL_NUM)) { | |
echo "price: ".$row[0] | |
echo "product_id".$row[1] | |
} |
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
git init . | |
git add . | |
git status | |
git commit -a -m "Popis commitu" | |
git log | |
git push | |
git pull | |
------ |
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
# Instalacia Heroku Toolbelt: | |
# https://toolbelt.heroku.com | |
heroku login | |
# Install postgres on local machine: | |
http://postgresapp.com | |
# and run: | |
http://bit.ly/1kBJJi2 |
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
@albums = Album.all(:conditions => ['published = ?', true], :order => 'created_at desc') | |
@albums_years = @albums.group_by { |a| a.created_at.beginning_of_year } | |
# group_by je tu klucovy, vsimni si ze sablona index potom pouziva tu premennu @albums_years | |
# Tie :conditions je samozrejme zastarala syntax, | |
# ale aj tak tebe bude stacit Album.all, resp Album.page(...) v pripade strankovania cez kaminari |
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 fancy(str) | |
str = str.gsub(/[ ]+/," ") | |
str = str.gsub(/ /,"-") | |
str = str.downcase | |
str = str.mb_chars.normalize(:kd).gsub(/[^\-x00-\x7F]/n, '').to_s | |
return str | |
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
# Pole s polozkami | |
@menu_items = [ | |
['messaging', messagging_path, 'Zpravy'], | |
['admin', admin_path, 'Administrace'] | |
] | |
# Generator menu |
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
# potrebujeme uzivatela v pravidelnych intervaloch udrziavat "pri zivote" | |
# musime mu teda niekde aktualizovat cas poslednej aktivity | |
# pomocou before filtra to docielime pri kazdom prekliku aplikaciou | |
# umiestnit do kazdeho controlleru, kde potrebujeme | |
before_filter :do_last_act | |
# application.rb |
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
# Default user | |
email = 'demo@demo.sk' | |
password = 'demodemo' | |
unless User.exists?(email: email) | |
User.create!(email: email, password: password, password_confirmation: password) | |
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
$ brew install mysql | |
==> Installing mysql dependency: cmake | |
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/cmake-2.8.7-bottle.tar.gz | |
######################################################################## 100.0% | |
==> Pouring cmake-2.8.7.bottle.tar.gz | |
Warning: m4 macros were installed to "share/aclocal". | |
Homebrew does not append "/usr/local/share/aclocal" | |
to "/usr/share/aclocal/dirlist". If an autoconf script you use | |
requires these m4 macros, you'll need to add this path manually. | |
==> Summary |
OlderNewer