Skip to content

Instantly share code, notes, and snippets.

View juananpe's full-sized avatar
🎯
Focusing

Juanan Pereira juananpe

🎯
Focusing
View GitHub Profile
@juananpe
juananpe / qunit-assert-canvas.js
Created February 18, 2018 12:36
qunit-assert-canvas.js
QUnit.extend(QUnit.assert, {
pixelEqual: function(canvas, x, y, r, g, b, a, message) {
var actual = Array.prototype.slice.apply(canvas.getContext("2d").getImageData(x, y, 1, 1).data),
expected = [r, g, b, a];
QUnit.push(QUnit.equiv(actual, expected), actual, expected, message);
},
pixelNotEqual: function(canvas, x, y, r, g, b, a, message) {
var actual = Array.prototype.slice.apply(canvas.getContext("2d").getImageData(x, y, 1, 1).data),
expected = [r, g, b, a];
message = message || "should not be " + expected;
@juananpe
juananpe / debugger.js
Created February 13, 2018 21:43
Código JS para el ejercicio con debugger
class Ejercicio {
constructor(){
this.w = this.width = 194, this.height= 122;
this.g = Array(this.width*(this.height+2)).fill(0);
for(let i=0; i< this.width; i++){
for(let j=0; j< this.height; j++){
if (j <= 2 || j >= this.height - 2 )
@juananpe
juananpe / debugger.html
Last active February 13, 2018 21:42
HTML para ejercicio con debugger
<!doctype html>
<html>
<head>
<script src="debugger.js"></script>
</head>
<body>
</body>
@juananpe
juananpe / ejercicio.html
Created February 13, 2018 21:39
Código HTML para el ejercicio de introducción a CSS
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="estiloa.css">
</head>
<body>
<div id="menu">
<ul>
<li><a href="index.html"> ERREZETAK</a></li>
<li><a href="formularioa.html">BIDALI ZURE ERREZETA </a></li>
@juananpe
juananpe / films.R
Created December 18, 2017 21:16
films.R
library('rvest')
url <- 'http://www.imdb.com/search/title?count=100&release_date=2018,2016&title_type=feature'
webpage <- read_html(url)
#Using CSS selectors to scrap the rankings section
rank_data_html <- html_nodes(webpage,'.text-primary')
#Converting the ranking data to text
rank_data <- html_text(rank_data_html)
#Data-Preprocessing: Converting rankings to numerical
@juananpe
juananpe / linearReg.R
Created December 18, 2017 21:16
linearReg.R
library(ggplot2)
# Price, Age, KM(kilometers driven), Fuel Type,
# HP(horsepower), Automatic or Manual, Number of Doors,
# and Weight in pounds are the data collected in this file for
# Toyota Corollas.
toyota <- read.csv("https://raw.githubusercontent.com/datailluminations/PredictingToyotaPricesBlog/master/ToyotaCorolla.csv")
g <- ggplot(toyota, aes(Price))
@juananpe
juananpe / intro.R
Last active December 18, 2017 21:15
intro.R
?cars
str(cars)
summary(cars)
gg <- ggplot(cars, aes(x=speed, y=dist)) +
geom_point()
plot(gg)
gg <- ggplot(cars, aes(x=speed, y=dist)) +
@juananpe
juananpe / Lag.java
Created November 30, 2017 12:24
Lag klasea
package hasiera;
import java.awt.Image;
import java.net.URL;
import java.util.Vector;
import javax.swing.ImageIcon;
public class Lag {
String izena;
@juananpe
juananpe / pom.xml
Created November 30, 2017 12:22
Proiektuan erabiltzeko pom.xml fitxategia (maven)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Taulak</groupId>
<artifactId>Taulak</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<directory>target</directory>
<outputDirectory>target/classes</outputDirectory>
<finalName>${artifactId}-${version}</finalName>
@juananpe
juananpe / assembly.xml
Created November 28, 2017 12:45
pom.xml assembly-plugin
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>hasiera.Taula</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>