Skip to content

Instantly share code, notes, and snippets.

View porfidev's full-sized avatar
⚛️
Now coding react-native

Porfirio Chávez porfidev

⚛️
Now coding react-native
View GitHub Profile
<script src="//player.ooyala.com/static/v4/production/latest/core.min.js"></script>
<script src="//player.ooyala.com/static/v4/production/latest/video-plugin/main_html5.min.js"></script>
<script src="//player.ooyala.com/static/v4/production/latest/video-plugin/osmf_flash.min.js"></script>
<script src="//player.ooyala.com/static/v4/production/latest/video-plugin/bit_wrapper.min.js"></script>
<script src="//player.ooyala.com/static/v4/production/latest/other-plugin/discovery_api.min.js"></script>
/** Estrellas a mostrar **/
const Stars = (props) => {
const numberOfStars = 1 + Math.floor(Math.random()*9);
// let stars = [];
// for(let i = 0; i < numberOfStars; i++){
// stars.push(<i key={i} className="fa fa-star"></i>);
// }
return (
<div className="col-5">
{_.range(numberOfStars).map(i =>
@porfidev
porfidev / Game.js
Created November 10, 2017 19:09
Juego de prueba para el curso de react.js (se necesita transpilar)
/** UTILITARIO **/
const possibleCombinationSum = function(arr, n) {
if (arr.indexOf(n) >= 0) { return true; }
if (arr[0] > n) { return false; }
if (arr[arr.length - 1] > n) {
arr.pop();
return possibleCombinationSum(arr, n);
}
var listSize = arr.length, combinationsCount = (1 << listSize)
for (var i = 1; i < combinationsCount ; i++ ) {
@porfidev
porfidev / _btg3.scss
Created November 28, 2017 15:02
Test de personalización ooyala Skin
.oo-scrubber-bar-container {
padding: 0;
margin: 0;
position: relative;
width: 80%;
}
.oo-control-bar-items-wrapper {
a.oo-time-duration {
&.oo-control-bar-duration {
@porfidev
porfidev / regexp.js
Created November 28, 2017 23:16
Expresiones REgulares Cheat Sheet
/** Declaración de expresiones regulares **/
var regexp = new RegExp('abc'); // Objeto
var regexp2 = /abc/; // Literales
/** Encontrar al menos un carácter en la lista **/
var regexp3 = /[0123456789]/;
var regexp3alter = /[0-9]/;
/** GUIA RAPIDA DE ATAJOS
@porfidev
porfidev / background-changer.js
Created January 2, 2018 01:47
Cambiar imagen de fondo con las obtenidas de un folder cada determinado tiempo
var folder = "images/";
var availableImages = [];
var time = 4000;
// Ejecutar un AJAX a un folder con las imágenes
// Importante que sea de acceso publico y sin un index.
$(document).ready(function () {
$.ajax({
url: folder,
success: function (data) {
@porfidev
porfidev / abstract_factory_GameMaker.ts
Created January 16, 2018 18:33
Fábrica Abstracta para Typescript
import {PS4GameFactory, XBOXGameFactory} from "./factory_clases";
export class GameMaker {
public constructor() {
const ps4Game = new PS4GameFactory();
this.tester(ps4Game);
const xboxGame = new XBOXGameFactory();
this.tester(xboxGame);
}
@porfidev
porfidev / 02-getList.es6
Last active February 13, 2018 17:22
Javascript ES6 Util Codes
let langSentence = 'Estos son los lenguajes requeridos: Javascript, PHP, Java, Python.';
// Inicio y fin de busqueda
let startSearch = langSentence.indexOf(':');
let endSearch = langSentence.indexOf('.', startSearch + 1);
// Obtener el texto despujes del inicio y fin
let langString = langSentence.substring(startSearch + 1, endSearch);
// Convertir cada elemento separado por coma en un elemento del arreglo
<?php
$name = "file-" . time();
$myfile = fopen($name, "w")
?>
@porfidev
porfidev / react-input-to-state.js
Last active September 14, 2020 11:15
React - Any form value to state
import React, { Component } from "react";
import "./App.css";
class App extends Component {
state = {
nombre: "",
email: "",
esAdmin: "",
genero: "",
color: "",