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
### Brojčano na ekranu ispišite koliko godina ima sekundi. | |
### Koliko imate godina ako ste stari 8286 dana? | |
print 365*24*60*60 | |
print 8286/365 |
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
### Ispišite svoje ime i prezime unatrag | |
### Ispišite trece slovo svog imena velikim slovom | |
print "Damir Svrtan".reverse | |
print "Damir"[2].capitalize |
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
### Napišite program koji ce ispisivati string od 10 slova i 5 znamenki | |
### i to svaki put u drukcijem rasporedu | |
### Napišite program koji ce ispisati brojeve od 1 do 10, svaki u svom redu | |
print "12345abcdefghij".split(//).shuffle.join | |
[1,2,3,4,5,6,7,8,9,10].each do |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
### Ispišite sve brojeve od 1 do 100, svaki u svom redu | |
### Ispišite brojeve od 17 do 32 u jednom redu, odvojite ih zarezom | |
### Ispišite random brojeve od 50 do 110 u jednom redu, odvojite ih zarezom | |
(1..100).each do |i| | |
puts i | |
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
### a) Ispišite sve brojeve od 1 do 1000 koji su djeljivi sa 13 ili 7 | |
### b) Napravite novi rječnik koji će sadržavati dva ključa. | |
### Ključevi: 15, 7 | |
### | |
### Pod ključem "15" u ovom hashu moraju biti svi brojevi | |
### od 1 do 1000 djeljivi sa 15 | |
### Pod ključem "7" u ovom hashu moraju biti svi brojevi | |
### od 1 do 1000 djeljivi sa 7 |
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 method(stringy) | |
puts stringy.split(//).count('a') | |
end | |
def method(string) | |
puts string.reverse | |
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
### 1. Create user class by implementing | |
### a. properties | |
### i. user_id | |
### ii. username | |
### iii. password | |
### iv. email | |
### b. methods | |
### i. greet (learn user to say "Hi! My name is <name>, nice to meet you." | |
### |
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 'rubygems' | |
require 'httparty' | |
require 'net/http' | |
require 'base64' | |
set :dump_errors, false | |
class Representative | |
include HTTParty |
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 'rubygems' | |
require 'httparty' | |
require 'net/http' | |
require 'base64' | |
set :dump_errors, false | |
class Representative | |
include HTTParty |
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
<script> | |
function getJson(){ | |
var proba='http://0.0.0.0:4568/; | |
var stuff = <%= Representative.get('http://0.0.0.0:4568/') %>; | |
var data = "data:image/jpeg;base64, "+stuff.imageBase64; | |
setTimeout(function(){document.getElementById("X_Axis").value=stuff.acceleration.X_Axis}, 200); | |
setTimeout(function(){document.getElementById("Y_Axis").value=stuff.acceleration.Y_Axis}, 400); | |
setTimeout(function(){document.getElementById("Z_Axis").value=stuff.acceleration.Z_Axis}, 600); | |
setTimeout(function(){document.getElementById("Latitude").value=stuff.latitude}, 800); | |
setTimeout(function(){document.getElementById("Longitude").value=stuff.longitude}, 1000); |
OlderNewer