View logger.swift
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
View robot.js
//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);
View robot.js
//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);
View test_exception.py
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
View test_gcd.py
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)
View sir.rb
sir = gets
array = sir.split
hash = {}
for i in array do
hash[i] = 0
end
for i in array do
hash[i]+=1
end
View bot.rb
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