Skip to content

Instantly share code, notes, and snippets.

View ileacristian's full-sized avatar

Ilea Cristian ileacristian

View GitHub Profile
#include <Servo.h>
int rotatePin = 2;
int verticalPin = 5;
int horizontalPin = 3;
int clawPin = 4;
bool initialized = false;
Servo servoRotate;
@ileacristian
ileacristian / logger.swift
Last active August 29, 2015 14:05
exemplu logger
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
@ileacristian
ileacristian / robot.js
Created December 5, 2012 17:23 — forked from 0x539/robot.js
0x539
//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);
@ileacristian
ileacristian / robot.js
Created December 5, 2012 06:58
SexPaFalie
//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);
@ileacristian
ileacristian / test_exception.py
Created October 11, 2011 22:02
python snippet
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
@ileacristian
ileacristian / test_gcd.py
Created October 11, 2011 21:02
python snippet
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)
@ileacristian
ileacristian / sir.rb
Created June 11, 2011 15:34
just some test code
sir = gets
array = sir.split
hash = {}
for i in array do
hash[i] = 0
end
for i in array do
hash[i]+=1
end
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