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
#include <Servo.h> | |
int rotatePin = 2; | |
int verticalPin = 5; | |
int horizontalPin = 3; | |
int clawPin = 4; | |
bool initialized = false; | |
Servo servoRotate; |
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
func myLog(message: String, function: String = __FUNCTION__, file: String = __FILE__, line: Int = __LINE__) { | |
println("Message: \(message)\ \n(From file: \(file), Function: \(function), Line: \(line))") | |
} | |
// Ex. apel | |
myLog("Salut") | |
// Exemplu de output |
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
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(100); |
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
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(100); |
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 foo(): | |
# corpul functiei | |
raise ValueError("Acesta este mesajul exceptiei") | |
try: | |
# bloc pentru codul "suspect" | |
foo() | |
except ValueError as exception: | |
# cod pentru tratarea exceptiei | |
print(exception.args[0]) # afisam primul argument al exceptiei |
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 test_gcd(): | |
assert gcd(0, 2) == 2 | |
assert gcd(2, 0) == 2 | |
assert gcd(2, 3) == 1 | |
assert gcd(2, 4) == 2 | |
assert gcd(6, 4) == 2 | |
assert gcd(24, 9) == 3 | |
try: | |
gcd(-2, 0) | |
gcd(0, -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
sir = gets | |
array = sir.split | |
hash = {} | |
for i in array do | |
hash[i] = 0 | |
end | |
for i in array do | |
hash[i]+=1 | |
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
require 'rubygems' | |
require 'mechanize' | |
require 'nokogiri' | |
file = File.open( File.join('','Users','Ilea Cristian','Desktop','test.html'), 'w') | |
agent = Mechanize.new | |
agent.user_agent_alias = 'Mac Safari' | |
agent.follow_meta_refresh = true |