Skip to content

Instantly share code, notes, and snippets.

View aitorjs's full-sized avatar
💪
Looking for a good remote job!

aitor aitorjs

💪
Looking for a good remote job!
View GitHub Profile
window.addEventListener("DOMContentLoaded", function () {
console.log("APARECE");
})}
@aitorjs
aitorjs / lnbits.js
Last active February 15, 2022 17:48
call to lnbits openapi using swagger-client
const SwaggerClient = require('swagger-client');
async function main() {
const requestInterceptor = (request) => {
request.headers["X-API-KEY"] = 'MY-X-API-KEY';
request.headers["Content-Type"] = 'application/json';
return request;
};
const client = await SwaggerClient({ url: 'https://legend.lnbits.com/openapi.json', requestInterceptor })
pragma solidity ^0.4.11;
// import './IERC20.sol';
// contract FuncToken is IERC20 {
contract FuncToken {
uint public constant _totalSupply = 1000000;
string public constant symbol = "FUNC";
0x759AeD42f6C188B640De2a8B1CaA1317bfd8cEF3
@aitorjs
aitorjs / uploadFile.ts
Last active March 18, 2019 20:40
Upload file using angular2 and nodejs (express)
// FRONTEND (angular2)
// product-form.compontent.html
<input type="file" (change)="fileChangeEvent($event)" placeholder="Upload file..." />
<button type="button" (click)="upload()">Upload</button>
// product-form.compontent.ts
import { Component, OnInit } from '@angular/core';
import { Http } from '@angular/http';
@Component({
@aitorjs
aitorjs / product.component.ts
Created November 19, 2016 03:29
pass data angular
import { bootstrap } from 'angular2/platform/browser';
import { Component, EventEmitter } from 'angular2/core';
import { NgFor } from 'angular2/common';
@Component({
selector: 'sub-component',
inputs: ['items'],
outputs: ['onItemSelected'],
directives: [NgFor],
template: `
@aitorjs
aitorjs / text
Created November 9, 2016 15:48
Pasos para añadir blueprint a angular-cli-env
## Pasos seguidos para customizar el addon llamado angular-cli-env para que use blueprints
(hacer uso del "hook" blueprintsPath, extender el objeto de configuracion del comando a EmberGenerateCommand.extend
y copiar las blueprints al sitio elegido)
0. Tener la última version de angular-cli funcionado.
1. Descargarse el paquete *npm i angular-cli-env* en ella.
2. Ir al código del módulo recien descargado: *cd node_modules/angular-cli-env*
3. En *node_modules/angular-cli-env/index* añadir la propiedad *blueprintsPath* de la siguiente manera:
@aitorjs
aitorjs / entity.js
Created November 6, 2016 21:40
Bleprint for ng generate entity with ember cli && angular-cli
var path = require('path');
var chalk = require('chalk');
var Blueprint = require('ember-cli/lib/models/blueprint');
var dynamicPathParser = require('../../utilities/dynamic-path-parser');
var findParentModule = require('../../utilities/find-parent-module').default;
var getFiles = Blueprint.prototype.files;
var stringUtils = require('ember-cli-string-utils');
var astUtils = require('../../utilities/ast-utils');
var NodeHost = require('@angular-cli/ast-tools').NodeHost;
module.exports = {
@aitorjs
aitorjs / index.html
Created November 5, 2016 17:58
Example to start learning javascript debuging with Google developer tools and Firefox dev tools
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script>
debugger;
let dog = 'Snickers';
@aitorjs
aitorjs / Ejemplo de bind-ing (nm2+typescript)
Last active October 23, 2016 18:48
Solución a problema de ámbito de variables dentro de funciones con bind(this)
// PROBLEMA. Bind error. No reconoce this.products de la linea 15.
import { Component } from '@angular/core';
import ApiWrapperService from './lib/apiWrapper.service';
import { Product } from './entitys/product'
export class AppComponent {
products: Array<Product>;