Skip to content

Instantly share code, notes, and snippets.

View jhurtadojerves's full-sized avatar
🏠
Working from home

Julio Hurtado jhurtadojerves

🏠
Working from home
  • Macas, Ecuador
  • 20:14 (UTC -05:00)
View GitHub Profile
$juegos = 'foo' //Lógica mediante la cual obtienes en primer lugar el juego
$juegos->each(function($juegos){
$juegos->equipo_2;
});
//Ya con esto puedes hacer lo siguiente:
$juego->equipo_2->foo; //Luego de un foreach.
@jhurtadojerves
jhurtadojerves / redux.js
Last active January 4, 2018 16:45
Reto de la clase de Redux, buscar en todas las playlist
const data = ( state, action ) => {
switch (action.type) {
case 'SEARCH_VIDEO': {
let results = [];
if (action.payload.query) {
const categories = state.data.categories
categories.map(category => {
let tempResults = category.playlist.filter(item => {
return item.author.toLowerCase().includes(action.payload.query.toLowerCase())
})
@jhurtadojerves
jhurtadojerves / arrow functions sintaxis.js
Created January 8, 2018 00:16
arrow functions sintaxis
(firstParam, secondParam, …, lastParam) => { statements }
(a) => { return a }
a => { return a }
a => a
() => { statements }
() => { return statement }
() => statement
//Arrow Function
const double = number => 2 * number
//Función tradicional
function double(number) {
return 2 * number
}
const numberOfPowersCalc = (book, books) => {
for (let i = 0; i++; i <= books.length)
if (book === books[i])
return i
}
let posts = parseInt((document.getElementsByClassName('row_data')[1].childNodes[0].data).replace('.', ''))
let characterSheet = document.querySelectorAll('#custom_fields_personaje ul li .row_data')
@jhurtadojerves
jhurtadojerves / webpack.config.js
Last active July 6, 2018 01:52
Webpack basic configuration from react.js
const path = require('path')
module.exports = {
mode: 'production',
entry: {
"home": path.resolve(__dirname, 'src/entries/home.js'),
},
output: {
path: path.resolve(__dirname, "dist"),
filename: 'js/[name].js',
{
"presets": [
["env"],
"react"
]
}
import React, { Component } from 'react'
import ReactDOM from 'react-dom'
const app = document.getElementById('app')
class Home extends Component {
render() {
return (
<div>
<p>Hola Mundo desde Reactjs :D</p>