Skip to content

Instantly share code, notes, and snippets.

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

Igor Octaviano igoroctaviano

🏠
Working from home
View GitHub Profile
# Recursive functions in ruby.
def factorial( number )
if number <= 1
1
else
number * factorial( number - 1 )
end
end
@igoroctaviano
igoroctaviano / CSSTricksV15Header.js
Created June 9, 2017 17:40
React implementation of the CSS Tricks v15 website header.
import React, { Component } from 'react';
export default class CSSTricksHeader extends Component {
constructor(props) {
super(props);
this.state = {
downFacingPoints: "M-4,-4 L1004,-4 L1004,90 L804,90 L604,90 L404,90 L204,90 L-4,90 L-4,90 L-4,-4 Z"
};
}
@igoroctaviano
igoroctaviano / BinaryTree.js
Created July 22, 2017 20:17
Drawing a simple Integer Binary Tree with p5
function BinaryTree() {
this.root = null;
}
BinaryTree.prototype.addValue = function(value) {
if (this.root == null) {
this.root = new Node(value);
this.root.x = width / 2;
this.root.y = 50;
} else {
@igoroctaviano
igoroctaviano / Node.js
Created July 22, 2017 20:17
Drawing a simple Integer Binary Tree with p5
function Node(value, x, y) {
this.value = value;
this.left = null;
this.right = null;
this.x = x;
this.y = y;
}
Node.prototype.addNode = function(node) {
if (node.value < this.value) {
@igoroctaviano
igoroctaviano / sketch.js
Created July 22, 2017 20:18
Drawing a simple Integer Binary Tree with p5
var binaryTree;
function setup() {
createCanvas(1000, 800);
background(51);
binaryTree = new BinaryTree();
for (var i = 0; i < 100; i++) {
binaryTree.addValue(floor(random(0, 1000)));
}
@igoroctaviano
igoroctaviano / index.html
Last active September 18, 2017 17:08
Automação em Ruby com Heroku, Rack, RSpec e Selenium
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="./css/index.css">
<script src="./js/index.js"></script>
<title>Hello!</title>
</head>
@igoroctaviano
igoroctaviano / index.js
Created September 18, 2017 17:09
Automação em Ruby com Heroku, Rack, RSpec e Selenium
window.onload = function () {
document.getElementById('login').addEventListener('submit', function(e) {
e.preventDefault();
document.getElementsByClassName('success')[0].style.display = 'block';
});
}
@igoroctaviano
igoroctaviano / index.css
Created September 18, 2017 17:10
Automação em Ruby com Heroku, Rack, RSpec e Selenium
.input-container {
padding: 10px;
}
.success {
color: green;
}
.visible {
display: block;
@igoroctaviano
igoroctaviano / login_spec.rb
Last active September 18, 2017 17:16
Automação em Ruby com Heroku, Rack, RSpec e Selenium
require 'selenium-webdriver'
describe 'Login' do
before :each do
chromedriver_path = File.join(File.absolute_path('../..', File.dirname(__FILE__)), "test", "browsers", "chromedriver")
Selenium::WebDriver::Chrome.driver_path = chromedriver_path
@driver = Selenium::WebDriver.for :chrome
end
@igoroctaviano
igoroctaviano / bash.txt
Created September 18, 2017 17:16
Automação em Ruby com Heroku, Rack, RSpec e Selenium
rspec spec/login_spec.rb
Failures:
1) Login succeeded
Got 0 failures and 2 other errors:
1.1) Failure/Error: @driver = Selenium::WebDriver.for :chrome
Selenium::WebDriver::Error::WebDriverError:
Unable to find chromedriver. Please download the server from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver.
# /var/lib/gems/2.3.0/gems/selenium-webdriver-3.5.2/lib/selenium/webdriver/common/service.rb:59:in `binary_path'
# /var/lib/gems/2.3.0/gems/selenium-webdriver-3.5.2/lib/selenium/webdriver/common/service.rb:49:in `initialize'
# /var/lib/gems/2.3.0/gems/selenium-webdriver-3.5.2/lib/selenium/webdriver/chrome/driver.rb:52:in `new'