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
.page-header | |
h2 = Device.listing_name | |
.table-responsive | |
table.table.table-condensed | |
thead | |
tr | |
th = t_attr :device | |
th = t_attr :auditorium | |
th = create_button Device |
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
# Performs SQL LIKE query on a ActiveRecord model. First | |
# parameter is the +query+, the rest is columns listing. | |
# One level nesting of belongs to assoctions is supported. | |
# | |
# Usage: | |
# | |
# Company.like("john", :name, :phone, :email, person: [ :name, :email ]) | |
# | |
# | |
def self.like(*args) |
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
body { | |
color: pink; | |
} |
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 'multitenant' | |
threads = 2.times.map do |i| | |
Thread.new(i) do |id| | |
Multitenant.current_tenant = id | |
sleep rand | |
if Multitenant.current_tenant == id | |
putc '.' |
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
# Vytvorte tridu Dog. | |
# Bude mit jednu instancni promennou @energy a dve metody. | |
# | |
# #eat! - zvysi energie o 10 | |
# #walk! - snizi hodnotu energie o 1 | |
# #bark! - snizi hodnotu energie o 5 | |
# | |
# alive? - true, kdyz energie je vetsi nez 0 | |
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 'sinatra' | |
require_relative './weather' | |
weather = Weather.new( pondeli: 'Jasno', | |
utery: 'Zatazeno', | |
streda: 'Dest') | |
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 'sinatra' | |
calendar = { | |
pondeli: 'Jasno', | |
utery: 'Zatazeno', | |
streda: 'Dest', | |
} | |
def make_table(calendar) | |
calendar.each_pair.map { |day,weather| |
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
# Priklad: | |
# | |
# Zeptejte se uzivatele na | |
# | |
# - operaci | |
# - cislo 'a' | |
# - cislo 'b' | |
# | |
# Provedte s cisly zadanou operaci a vysledek vypiste. |
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 fibo(n) | |
vysledky = [ 0,1 ] | |
if n == 0 or n == 1 | |
n | |
else | |
i = vysledky.size | |
while i <= n | |
fibonacci = vysledky[i-1] + vysledky[i-2] |
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 'open-uri' | |
require 'pry' | |
# { | |
# 'Hamlet' => 334, | |
# 'the' 323423535 | |
# #.... | |
# } | |
#frequency = {} |
NewerOlder