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
@aitorjs
aitorjs / metodo.eloquent
Created August 30, 2014 17:38
Funcion e uso de un "metodo" que busca los datos de una galeria junto con sus imagenes y se le puede añadir parametros de filtrado.
Route::get('prueba', function() {
/* call */
$values = array(
'orderBy' => 'name',
'orderByDirection' => 'asc',
'search' => '');
$gallery = busqueda($values);
/* presentation */
echo "<pre>";
'use strict'
var request = require('request')
var cheerio = require('cheerio')
function fetch(day, month, lang, events) {
return new Promise(function(resolve) {
var events = []
var metadata = []
request(`https://${lang}.wikipedia.org/wiki/${day}_de_${month}`, function (error, response, html) {
@aitorjs
aitorjs / Preferences.sublime-settings
Created July 30, 2016 11:42
Configuración for Sublime Text (Preferences -> Settings - User )
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"font_size": 14,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage"
],
"save_on_focus_lost": true,
@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>;
@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 / 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 / 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 / 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 / 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({
0x759AeD42f6C188B640De2a8B1CaA1317bfd8cEF3