Skip to content

Instantly share code, notes, and snippets.

View JoaoGFarias's full-sized avatar
🏠
Working from home

João Farias JoaoGFarias

🏠
Working from home
View GitHub Profile
cpdef int fib(int n):
cpdef fibAux(int n, int a, int b):
if n == 0:
return a
else:
return fibAux(n-1,a+b,a)
if n == 2 or n == 1:
return n
'''
Look at foo1 and foo2
Foo1 makes a comparison, uses an if on each interation and is able to stop interacting at any point of the array
Foo2 a comparison, a boolean calculus and an attribution at each interaction, and always loop through ALL the array
Let's see how they run...
'''
import time
@JoaoGFarias
JoaoGFarias / Triangle of Numbers Printer
Created May 4, 2014 03:02
A simple script that prints a beatiful triangle using a recursion (printLine) inside other recursion (printTriangle)
#!/usr/local/bin/python2.7
import sys
def printLine(n):
sys.stdout.write(str(n))
if n != 1:
sys.stdout.write(' ')
printLine(n-1)
else:
@JoaoGFarias
JoaoGFarias / Subdivision.py
Last active August 29, 2015 14:02
Subdivision of a Bezier Curve
__author__ = 'Joao'
from Geometry.Point import ControlPoints
from Geometry.Point import Point2D
from bezierCurveAlgorithms.deCasteljau import bezier_curve_generator
from fn import recur
def subdivide(control_points,t = 0.5):
"""
@param control_points: The control points of the Bezier curve
@JoaoGFarias
JoaoGFarias / interface.html
Created August 14, 2014 12:47
HTML5 Local Storage - Tizen and JSON integration
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="description" content="A single-page template generated by Tizen Web IDE"/>
<title>HTMl 5 - JSon - Test</title>
<link rel="stylesheet" href="./css/jquery.mobile-1.3.2.css"/>
@JoaoGFarias
JoaoGFarias / miniMapsAPI.js
Last active August 29, 2015 14:05
Mini-Google Maps API
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
@JoaoGFarias
JoaoGFarias / gist:73380ef76bd153540ea7
Created September 8, 2014 12:55
Selenium - Parallel Data-Driven testing using TestNG
/*This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@JoaoGFarias
JoaoGFarias / persistentTreePHP.php
Created January 5, 2015 18:55
A persistent binary search tree in PHP
<?php
abstract class Node{
abstract public function __construct($left,$val,$right);
abstract public function isEmpty();
abstract public function insert($val);
abstract public function member($val);
}
@JoaoGFarias
JoaoGFarias / collectionFilterJava8.java
Last active August 29, 2015 14:13
Collection filter using Java 8
ArrayList<String> owners = new ArrayList<String>();
ArrayList<String> owner1Teams = new ArrayList<String>();
//Creating the unfilter collection
owners.add("Owner 1 - Team 1");
owners.add("Owner 1 - Team 2");
owners.add("Owner 2 - Team 1");
owners.add("Owner 2 - Team 2");
@JoaoGFarias
JoaoGFarias / data.csv
Created August 1, 2015 16:28
Projetando as contas parceladas
Loja 1 07/06 24.99