Skip to content

Instantly share code, notes, and snippets.

function exportAsJSON(fileName, myJsonObject){
var data = "text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(myJsonObject));
var a = document.createElement('a');
a.href = "data: "+data;
a.download = fileName+".json";
a.click();
}
var someData = {
name: "John",
@Maes95
Maes95 / exportAsPDF.js
Last active March 15, 2017 11:17
Simple export HTML element to PDF
function exportToPDF(title, id, css){
setTimeout(function () {
var printWindow = window.open("", "", "width=1000, height=800");
printWindow.document.write('<html><head><title>'
+title
+'</title>'
+css
+'</head><body onload="window.print()">'
+ document.getElementById(id).innerHTML
+ '</body></html>');
/**
* PARA EJECUTAR -> node script.js > script.sql
*/
var films = [
{
id: 1,
title: "Assassin's Creed",
year: 2017,
country: "Francia",
angular.module('myApp')
.controller('FilmsController', ['$scope','$location','Film','Auth' ,function($scope, $location, Film,Auth){
$scope.allTags = [];
$scope.selectedTags = [];
Film.query(function(response) {
$scope.films = response ? response : [];
$scope.allTags = getTags();
$('#multi-select').dropdown();
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
*
* @author michel
*/
public class NewMain {
void delanteDerecha(int velocidad){
Serial.print("Delante derecha!");
controlMotor("del_der", 1, 0);
controlMotor("del_izq", 1, velocidad);
controlMotor("atr_der", 1, velocidad);
controlMotor("atr_izq", 1, 0);
}
void controlMotor(String motorStr,int mdirection, int velocidad){
int IN1;
@Maes95
Maes95 / SetUp.sh
Last active December 7, 2017 00:05
SetUp.sh
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get -y install docker-ce
sudo docker pull maes95/vertx-chat
sudo docker run -p 80:8000 maes95/vertx-chat
@Maes95
Maes95 / downloadDocker.sh
Created January 31, 2018 01:09
Docker Download
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get -y install docker-ce
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
wget https://bintray.com/artifact/download/vertx/downloads/vert.x-3.5.0.tar.gz
tar xzvf vert.x-3.5.0.tar.gz
# CMD
./vertx/bin/vertx
library(dplyr)
library(magrittr)
data <- read.csv("adult.csv", header = FALSE, sep = ",")
colnames(data) <- c("Age",
"Workclass",
"Fnlwgt",
"Education",
"EducationNum",
"MaritalStatus",