Skip to content

Instantly share code, notes, and snippets.

View 11joselu's full-sized avatar
🎯
Focusing

Jose Cabrera 11joselu

🎯
Focusing
View GitHub Profile
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<items>
<item>
0especial="https://pastebin.com/raw/iB2Wq6wM"
1tv="http://bit.ly/cristal_tv_git"
2deportes="https://gist.githubusercontent.com/11joselu/cfa123aad15cdb855cba187aea2817e4/raw/97545e08249cd8da70a4c0d039b55299dab0bb57/gistfile1.txt"
function importScript(path, events = []) {
return new Promise(function(resolve, reject) {
if (Array.isArray(events) && events.length) {
// Por cada evento lo añadimos a window tan sólo una vez
return events.forEach(function(event) {
window.addEventListener(
event,
function() {
loadScript(path)
.then(resolve)
@11joselu
11joselu / loadScript.js
Last active February 3, 2020 17:37
Load Script Promises
// Creamos un tag Script y lo añadimos al Head
// Añadimos los enventos onload/onerror que nos
// permitirá resolver/rechazar las promesas
// Y eliminamos el elemento del DOM
const loadScript = function(path) {
const script = document.createElement('script');
script.type = 'text/javascript';
script.src = path;
script.async = true;
entry.promise = new Promise((resolve, reject) => {
This file has been truncated, but you can view the full file.
<Button type="addasdas">addas</Button>
<Button type="addasdas">addas</Button>
<Button type="addasdas">addas</Button>
<Button type="addasdas">addas</Button>
<Button type="addasdas">addas</Button>
<Button type="addasdas">addas</Button>
<Button type="addasdas">addas</Button>
<Button type="addasdas">addas</Button>
<Button type="addasdas">addas</Button>
<Button type="addasdas">addas</Button>
@11joselu
11joselu / app.php
Created August 6, 2019 19:10
PHP DOM example
<?php
$my_components = "
<NavbarItems>
<NavbarItemLink>Page 1</NavbarItemLink>
<NavbarItemLink>Page 2</NavbarItemLink>
<NavbarItemLink>Page 3</NavbarItemLink>
</NavbarItems>
";
@11joselu
11joselu / app.php
Created August 4, 2019 12:54
first app wc tutorial
<NavbarItems>
<NavbarItemLink>Page 1</NavbarItemLink>
<NavbarItemLink>Page 2</NavbarItemLink>
<NavbarItemLink>Page 3</NavbarItemLink>
</NavbarItems>
@11joselu
11joselu / cloudSettings
Created October 18, 2018 10:22
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-10-18T10:22:13.836Z","extensionVersion":"v3.2.0"}
@11joselu
11joselu / index.html
Created June 21, 2017 17:09
Todo App with Jquery
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css'/>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<title>Document</title>
<style>
@11joselu
11joselu / import_script.ts
Last active May 10, 2017 08:22
Inject imports into another file and export array of routes for gulp
#!/bin/node
const through = require('through2');
const ARRAY_REGEX = new RegExp(/(\[).*([\s\t\n]?.*)+(\])/g);
const IMPORT_REGEX = new RegExp(/import.+([\'|\"])/g);
const OBJECT_REGEX = new RegExp(/(\{).*([\s\t\n]?.*)+(\})/gi);
function concatArray(arr: string[], items: string[]): string[] {
return arr.concat(items);
}