Skip to content

Instantly share code, notes, and snippets.

@jmtt89
jmtt89 / index.html
Created November 22, 2018 14:17
WebComponent Template
<html>
<head>
<title>Web Component Demo</title>
</head>
<body>
<my-component att="45"></my-component>
<script src="/src/myComponent.js"></script>
</body>
@jmtt89
jmtt89 / UserCard.ES5.js
Last active November 8, 2018 05:27
Codigo del tutorial https://www.codementor.io/ayushgupta/vanilla-js-web-components-chguq8goz convertido a ES5 para compatibilidad con IE11
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if
@jmtt89
jmtt89 / html2Image.js
Created October 9, 2018 19:19
Convertir un sitio web en una imagen jpg desde NodeJS (Asyncrono)
'use strict'
const phantom = require('phantom');
// Se crea un pool para que puedan atenderse varias solicitudes de manera asincrona
const genericPool = require("generic-pool");
const factory = {
create: function() {
return phantom.create();
},
@jmtt89
jmtt89 / LifecycleHandler.java
Created November 8, 2017 14:13
This gits show easy way to check if Android app is launched from Background or Foreground
package com.jmtt89.example;
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
import android.util.Log;
public class LifecycleHandler implements Application.ActivityLifecycleCallbacks {
private static final String TAG = "LifecycleHandler";
private Asteroids.BackgroundListener listener;